Does pyrax use servicenet if it's possible, or should I set it manually?

281 views Asked by At

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?

1

There are 1 answers

1
rdodev On BEST ANSWER

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.