Timestamp request expired
Closed this issue · 3 comments
caelghoul commented
Suddenly I get this message for any request
{'msg': 'Timestamp request expired', 'code': '50102'}
- I tried change the api key
- change timezone
nothing worked, mostly the problem from server :(
caelghoul commented
class OkxClient(Client):
def _request(self, method, request_path, params):
if method == c.GET:
request_path = request_path + utils.parse_params_to_str(params)
#timestamp = utils.get_timestamp() <--- comment
#if self.use_server_time: <--- comment
timestamp = self._get_timestamp()
body = json.dumps(params) if method == c.POST else ""
if self.API_KEY != '-1':
sign = utils.sign(utils.pre_hash(timestamp, method, request_path, str(body), self.debug), self.API_SECRET_KEY)
header = utils.get_header(self.API_KEY, sign, timestamp, self.PASSPHRASE, self.flag, self.debug)
else:
header = utils.get_header_no_sign(self.flag, self.debug)
response = None
if self.debug == True:
logger.debug(f'domain: {self.domain}')
logger.debug(f'url: {request_path}')
logger.debug(f'body:{body}')
if method == c.GET:
response = self.get(request_path, headers=header)
elif method == c.POST:
response = self.post(request_path, data=body, headers=header)
return response.json()
okxapi commented
Please make sure you updated okx-python lib to the latest version
okxapi commented
You should get request timestamp locally, not by the timestamp fetch by API