2014-01-17 105 views
1

我正在使用pyrax来操纵Rackspace云文件。 我可以强迫pyrax使用servicenet而不是publicnet,还是自动选择?pyrax是否可以使用servicenet,或者我应该手动设置吗?

在django-culus设置中,我们有settings.CUMULUS['SERVICENET']参数来处理它,但是我没有找到,如何将这个参数设置为pyrax本身。

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>) 

在哪里可以告诉pyrax使用servicenet?

+0

我的回答下面回答你的问题吗? – rdodev

回答

4

设置公众False创建连接时,明确:

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

文档上connect_to_cloudfiles

创建一个客户端与云端档案工作。默认为 连接到公共URL;如果您需要使用ServiceNet 连接,请将False传递给'public'参数。

来源:pyrax/init.py, connect_to_files method

+0

Thx为扩大答案,@ kyle-kelley! – rdodev

相关问题