简体   繁体   English

pyrax是否会使用servicenet,还是应该手动设置它?

[英]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.

相关问题 使用pyrax设置Rackspace CloudServer元数据 - Set Rackspace CloudServer Metadata with pyrax 最佳实践:应该在Python代码中大量使用异常处理程序,还是应该避免使用异常处理程序? - Best practice: should I use exception handlers a lot in Python code, or should I avoid if it's possible? 在烧瓶中,我应该手动捕获视图中的所有可能错误吗? - In flask, should i manually catch all possible error in views? 如何手动设置holoview的彩条的限制? - How do I manually set the limits of a holoview's colorbar? 我应该使用 numpy 的随机生成器吗? - Should I use numpy's Random Generator? 编译器在编译时会自动使用GPU还是必须手动使用它? - Does the compiler automatically use GPU while compiling or shall I have to use it manually? 如何使用python pyrax获取在机架空间上载的文件的永久URL - How can I get permanent URL of file uploaded on rackspace using python pyrax matplotlib-我应该使用哪种set_major_locator - matplotlib - what kind of set_major_locator should I use 我应该使用Django的contrib应用程序还是构建自己的应用程序? - Should I use Django's contrib applications or build my own? 我应该在Django的save方法中的哪里使用原子事务? - Where should I use atomic transactions in Django's save method?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM