Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_req_headers_list in curl module doesn't work as intended #191

Open
MelihDarcanxyz opened this issue Jul 21, 2022 · 3 comments
Open

_req_headers_list in curl module doesn't work as intended #191

MelihDarcanxyz opened this issue Jul 21, 2022 · 3 comments
Labels
bug Problem in the code

Comments

@MelihDarcanxyz
Copy link
Contributor

Describe the bug
I can't send authorizaton or any kind of headers to websites with curl module in pypath if the headers are defined as dictionary.

To Reproduce
Steps to reproduce the behavior:

  1. Define headers as dictionary
  2. Transmit them, for example use them to authorize in an API.

Expected behavior
I wanted it (_req_headers_list) to turn dictionary headers to list objects.

Traceback
I don't have a traceback but I see that no headers are transmitted. If I turn them into list object everything works fine. After the initial connection, it doesn't matter at all since curl is using cached data. The problem lies within the _req_headers_list module. I suspect the self.req_headers = self.req_headers or [] line but I'm not quite sure since it looks logically okay.

Desktop (please complete the following information):

  • OS: Linux 5.15.54-1-lts x86_64
  • Python version: Python 3.10.5
@MelihDarcanxyz MelihDarcanxyz added the bug Problem in the code label Jul 21, 2022
@MelihDarcanxyz
Copy link
Contributor Author

Just tried the function on a jupyter notebook and it worked as it should. I'm not sure whether it's a problem about Curl class or me problem. Curl class still can't understand dictionary headers though.

@deeenes
Copy link
Member

deeenes commented Nov 30, 2022

Reading the code it seems to me both lists or dicts should work fine, i.e. the headers can be passed either as ["Accept-encoding: gzip, deflate"] or {"Accept-encoding": "gzip, deflate"}. If you have different experience, please send a specific example.

@MelihDarcanxyz
Copy link
Contributor Author

Well, the latter just didn't work at the time while the former worked quite wells. I read the code too but couldn't figure out why. Will try it when I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Problem in the code
Projects
None yet
Development

No branches or pull requests

2 participants