question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

connection header is not used as session headers are not used

See original GitHub issue

https://github.com/ccxt/ccxt/blob/2cad76f3896be2f090daf897885921695043fc16/python/ccxt/base/exchange.py#L574

Here there should be an extra line headers.update(self.session.headers) .

But for kucoin, I get Invalid KC-API-SIGN after changing this.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
kroitorcommented, Apr 21, 2022

I don’t want to set any extra headers. I am saying that default session headers are not used.

Ah, ok, now I get it, will check that and will be back to you asap. Thx!

0reactions
SmartManojcommented, Apr 21, 2022

https://github.com/ccxt/ccxt/blob/2cad76f3896be2f090daf897885921695043fc16/python/ccxt/base/exchange.py#L574

Here there should be an extra line headers.update(self.session.headers) .

But for kucoin, I get Invalid KC-API-SIGN after changing this.

Now I didn’t get the error which I got for fetch_order_book.

Headers: Before: fetch Request: kucoin GET https://openapi-v2.kucoin.com/api/v3/market/orderbook/level2?symbol=BTC-USDT RequestHeaders: {'User-Agent': 'python-requests/2.27.1', 'Accept-Encoding': 'gzip, deflate'} RequestBody: None

After: fetch Request: kucoin GET https://openapi-v2.kucoin.com/api/v3/market/orderbook/level2?symbol=BTC-USDT RequestHeaders: {'User-Agent': 'python-requests/2.27.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'} RequestBody: None

Used masked_request_headers = {k:v for k,v in request_headers.items() if not k.startswith('KC-')} for verbose print

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connection - HTTP - MDN Web Docs
The Connection general header controls whether the network connection stays open after the current transaction finishes.
Read more >
Advanced Client Usage — aiohttp 3.8.3 documentation
Create the session first, use the instance for performing HTTP requests and initiating WebSocket connections. The session contains a cookie storage and ...
Read more >
Sessions apparently corrupting header values on subsequent ...
The weird thing, though, is that accessing https://httpbin.org/headers with a session, it tells me the request was sent with Connection: close ...
Read more >
Chapter 6. Handling HTTP Requests - STON Edge Server
For an HTTP request like this, a “Connection: Close” response will be returned regardless of the virtual host settings. The Keep-Alive header will...
Read more >
Python-Requests close http connection - Stack Overflow
Lets say i create a session using "with" in one function and return the session. Use the session in all my tests. How...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found