Time 如何使用Python更改二进制服务器时间? 问题:

Time 如何使用Python更改二进制服务器时间? 问题:,time,server,vpn,binance,Time,Server,Vpn,Binance,如何使用编程语言Python更改最大的加密货币交换之一Binance的服务器时间 细节 我正在使用python库`与Binance交互 当我输入下面的代码时,您可以根据您的位置获得当地时间 由于我在法国,结果如下: >>> datetime.datetime(2020, 5, 23, 12, 49, 10, 13000) 即使我在法国,我想让Binance认为我在美国东部(如纽约)。因此,我尝试了python二进制库中支持的请求库,如下所示 但是我得到了下面的错误消息 >

如何使用编程语言Python更改最大的加密货币交换之一Binance的服务器时间

细节
  • 我正在使用python库`与Binance交互
  • 当我输入下面的代码时,您可以根据您的位置获得当地时间 由于我在法国,结果如下:

    >>> datetime.datetime(2020, 5, 23, 12, 49, 10, 13000)
    
  • 即使我在法国,我想让Binance认为我在美国东部(如纽约)。因此,我尝试了python二进制库中支持的请求库,如下所示
  • 但是我得到了下面的错误消息

    >>> BinanceAPIException: APIError(code=-1021): Timestamp for this request was 1000ms ahead of the server's time.
    
    您可以在python二进制库的中找到关于上述代码的更多详细信息。在网站中找到http服务器。下面还提供了纽约代理列表的屏幕截图

    对于Windows,请尝试以下操作: 净停止W32时间 w32tm/取消注册 w32tm/寄存器 网络启动W32时间 w32tm/再同步

    import time
    import win32api
    
    client = Client(api_key, api_secret)
    server_time = client.get_server_time()
    gmtime=time.gmtime(int((server_time["serverTime"])/1000))
    win32api.SetSystemTime(gmtime[0],gmtime[1],0,gmtime[2],gmtime[3],gmtime[4],gmtime[5],0) // Needed Administrator Permission
    
    >>> BinanceAPIException: APIError(code=-1021): Timestamp for this request was 1000ms ahead of the server's time.
    
    import time
    import win32api
    
    client = Client(api_key, api_secret)
    server_time = client.get_server_time()
    gmtime=time.gmtime(int((server_time["serverTime"])/1000))
    win32api.SetSystemTime(gmtime[0],gmtime[1],0,gmtime[2],gmtime[3],gmtime[4],gmtime[5],0) // Needed Administrator Permission