Question

I'm using pyrax to manipulate Rackspace Cloud Files. Can I force pyrax to use servicenet instead of publicnet, or is it choosen automatically?

In django-cumulus settings we have settings.CUMULUS['SERVICENET'] parameter to handle it, but I didn't found, how to set this param to pyrax itself.

import pyrax

cls = pyrax.utils.import_class('pyrax.identity.rax_identity.RaxIdentity')
pyrax.identity = cls()
pyrax.set_setting('region', <REGION>)
pyrax.set_credentials(<USERNAME>, <API_KEY>)
cf = pyrax.cloudfiles
rackspace_media_container = cf.get_container(<CONTAINER>)

Where can I tell pyrax to use servicenet?

Was it helpful?

Solution

Set public to False when creating the connection, explicitly:

cf = pyrax.connect_to_cloudfiles(region=<REGION>, public=False)

Documentation on connect_to_cloudfiles:

Creates a client for working with cloud files. The default is to connect to the public URL; if you need to work with the ServiceNet connection, pass False to the 'public' parameter.

Source: pyrax/init.py, connect_to_files method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top