本文整理汇总了Python中plotly.plotly.sign_in方法的典型用法代码示例。如果您正苦于以下问题:Python plotly.sign_in方法的具体用法?Python plotly.sign_in怎么用?Python plotly.sign_in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plotly.plotly
的用法示例。
在下文中一共展示了plotly.sign_in方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from plotly import plotly [as 别名]
# 或者: from plotly.plotly import sign_in [as 别名]
def __init__(self,
apiKey=None,
username=None,
experimentName="experiment"):
# Instantiate API credentials.
try:
self.apiKey = apiKey if apiKey else os.environ["PLOTLY_API_KEY"]
except:
print ("Missing PLOTLY_API_KEY environment variable. If you have a "
"key, set it with $ export PLOTLY_API_KEY=api_key\n"
"You can retrieve a key by registering for the Plotly API at "
"http://www.plot.ly")
raise OSError("Missing API key.")
try:
self.username = username if username else os.environ["PLOTLY_USERNAME"]
except:
print ("Missing PLOTLY_USERNAME environment variable. If you have a "
"username, set it with $ export PLOTLY_USERNAME=username\n"
"You can sign up for the Plotly API at http://www.plot.ly")
raise OSError("Missing username.")
py.sign_in(self.username, self.apiKey)
self.experimentName = experimentName
示例2: _plot_option_logic
# 需要导入模块: from plotly import plotly [as 别名]
# 或者: from plotly.plotly import sign_in [as 别名]
def _plot_option_logic(plot_options_from_call_signature):
"""
Given some plot_options as part of a plot call, decide on final options.
Precedence:
1 - Start with DEFAULT_PLOT_OPTIONS
2 - Update each key with ~/.plotly/.config options (tls.get_config)
3 - Update each key with session plot options (set by py.sign_in)
4 - Update each key with plot, iplot call signature options
"""
default_plot_options = copy.deepcopy(DEFAULT_PLOT_OPTIONS)
file_options = tools.get_config_file()
session_options = get_session_plot_options()
plot_options_from_call_signature = copy.deepcopy(plot_options_from_call_signature)
# Validate options and fill in defaults w world_readable and sharing
for option_set in [plot_options_from_call_signature,
session_options, file_options]:
utils.validate_world_readable_and_sharing_settings(option_set)
utils.set_sharing_and_world_readable(option_set)
# dynamic defaults
if ('filename' in option_set and
'fileopt' not in option_set):
option_set['fileopt'] = 'overwrite'
user_plot_options = {}
user_plot_options.update(default_plot_options)
user_plot_options.update(file_options)
user_plot_options.update(session_options)
user_plot_options.update(plot_options_from_call_signature)
user_plot_options = {k: v for k, v in user_plot_options.items()
if k in default_plot_options}
return user_plot_options