def get_server_secret(credentials, expires):
""" Fetch server secret from CertiVox server """
path = 'serverSecret'
params = urllib.urlencode({
'app_id': credentials['app_id'],
'expires': expires,
'signature': sign_message(
'{}{}{}'.format(path, credentials['app_id'], expires),
str(credentials['app_key'])
)
})
try:
response = urllib2.urlopen('{api_url}{end_point}?{params}'.format(
api_url=credentials['api_url'],
end_point=path,
params=params,
))
except urllib2.HTTPError as e:
if e.code == 408:
print "Make sure your time it correct!"
raise ScriptException('Response code: {} - {}'.format(e.code, e.read()))
data = json.loads(response.read())
return data['serverSecret']
getServerSecretShare.py 文件源码
python
阅读 32
收藏 0
点赞 0
评论 0
评论列表
文章目录