最近要开发一款抢购秒杀的小工具,需要同步系统时间,这里分享两个时间服务器接口api给大家:
1.淘宝时间服务器时间接口
http://api.m.taobao.com/rest/api3.do?api=mtop.common.gettimestamp
返回json数据
{"api":"mtop.common.gettimestamp","v":"*","ret":["success::接口调用成功"],"data":{"t":"1586519130440"}}
python获取淘宝时间服务器时间示例
1 import requests
2 import time
3
4 class timetaobao(object):
5 r1 = requests.get(url='http://api.m.taobao.com/rest/api3.do?api=mtop.common.gettimestamp',
6 headers={'user-agent': 'mozilla/5.0 (windows nt 10.0; wow64) applewebkit/537.36 (khtml, like gecko) chrome/55.0.2883.87 ubrowser/6.2.4098.3 safari/537.36'})
7 x = eval(r1.text)
8 timenum = int(x['data']['t'])
9
10 def funcname():
11 timestamp = f