zoukankan      html  css  js  c++  java
  • 分享淘宝时间服务器同步时间接口api和苏宁时间服务器接口api

    最近要开发一款抢购秒杀的小工具,需要同步系统时间,这里分享两个时间服务器接口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 = float(timeTaobao.timeNum/1000)
    12         timeArray = time.localtime(timeStamp)
    13         otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
    14         return otherStyleTime
    15 
    16 t = timeTaobao.funcname()
    17 print(t)

    2.苏宁时间服务器接口api:

    http://quan.suning.com/getSysTime.do

    返回json数据

    {"sysTime2":"2020-04-10 19:46:50","sysTime1":"20200410194650"}
  • 相关阅读:
    UVA 10618 Tango Tango Insurrection
    UVA 10118 Free Candies
    HDU 1024 Max Sum Plus Plus
    POJ 1984 Navigation Nightmare
    CODEVS 3546 矩阵链乘法
    UVA 1625 Color Length
    UVA 1347 Tour
    UVA 437 The Tower of Babylon
    UVA 1622 Robot
    UVA127-"Accordian" Patience(模拟)
  • 原文地址:https://www.cnblogs.com/daxiangxm/p/taobaotime.html
Copyright © 2011-2022 走看看