如果可能的话,pyrax是否使用servicenet,或者我应该手动设置它?

2024-05-28 19:07:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我在用pyrax操作Rackspace云文件。 我可以强制pyrax使用servicenet而不是publicnet,还是它是自动选择的?在

在django积云设置中,我们有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?在


Tags: 文件djangoimportnetsettingscontainerservicerackspace
1条回答
网友
1楼 · 发布于 2024-05-28 19:07:58

创建连接时,将public设置为False,显式:

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

关于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.

来源:pyrax/init.py, connect_to_files method。在

相关问题 更多 >

    热门问题