fix: #55 incorrect timestamp format in 'OK-ACCESS-TIMESTAMP' header when use_server_time=True is used
This commit is contained in:
parent
e2e7b4f8af
commit
26956b9b5e
|
|
@ -1,4 +1,5 @@
|
||||||
import json
|
import json
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
from httpx import Client
|
from httpx import Client
|
||||||
|
|
@ -50,6 +51,7 @@ class OkxClient(Client):
|
||||||
request_path = c.API_URL + c.SERVER_TIMESTAMP_URL
|
request_path = c.API_URL + c.SERVER_TIMESTAMP_URL
|
||||||
response = self.get(request_path)
|
response = self.get(request_path)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
return response.json()['data'][0]['ts']
|
ts = datetime.fromtimestamp(int(response.json()['data'][0]['ts']) / 1000.0, tz=timezone.utc)
|
||||||
|
return ts.isoformat(timespec='milliseconds').replace('+00:00', 'Z')
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue