[英]Does pyrax use servicenet if it's possible, or should I set it manually?
I'm using pyrax to manipulate Rackspace Cloud Files. 我正在使用pyrax操纵Rackspace云文件。 Can I force pyrax to use servicenet instead of publicnet, or is it choosen automatically?
我可以强制吡喃使用servicenet代替publicnet,还是自动选择它?
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. 在django-cumulus设置中,我们有
settings.CUMULUS['SERVICENET']
参数来处理它,但是我没有找到如何将此参数设置为吡喃本身。
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? 我在哪里可以告诉pyrax使用servicenet?
Set public to False
when creating the connection, explicitly: 创建连接时,将public显式设置为
False
:
cf = pyrax.connect_to_cloudfiles(region=<REGION>, public=False)
Documentation on connect_to_cloudfiles
: 关于
connect_to_cloudfiles
文档:
Creates a client for working with cloud files.
创建用于处理云文件的客户端。 The default is to connect to the public URL;
默认设置是连接到公共URL。 if you need to work with the ServiceNet connection, pass False to the 'public' parameter.
如果您需要使用ServiceNet连接,请将False传递给'public'参数。
Source: pyrax/ init .py, connect_to_files method . 来源: pyrax / init .py,connect_to_files方法 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.