Artem Bar
Artem Bar

Reputation: 51

Kraken API Request-sent exception

After a simple query

k.query_public('Ticker', {'pair' : 'GNOETH'})['result']['GNOETH']['b'][0])

if I'm getting a time-out or other exception like 504, the next query and all next queries in my cycle are getting this exception:

http.client.CannotSendRequest: Request-sent

How can I prevent this?

Upvotes: 2

Views: 528

Answers (2)

Ori.B
Ori.B

Reputation: 159

Try also to ensure that the value of "nonce" is set to 0 at the api-key creation.

Upvotes: 0

Artem Bar
Artem Bar

Reputation: 51

I've got an answer - you have to close a connection with k.conn.close() in exception:

 while True:
  try:
   trades = k.query_public('Trades', {'pair' : 'ETHUSD'})
   return trades
   break
  except Exception as ex:
   k.conn.close()

Upvotes: 3

Related Questions