{"number":6566,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6566","title":"Import error with werkzeug","body_clean":"When I run `make ci` on the main branch, it throws this import error with werkzeug\n\n```\nImportError: cannot import name 'parse_authorization_header' from 'werkzeug.http' (\/opt\/hostedtoolcache\/Python\/3.8.18\/x64\/lib\/python3.8\/site-packages\/werkzeug\/http.py)\nmake: *** [Makefile:8: ci] Error 1\n```\n\n## Expected Result\n\nTo run make ci successfully on the main branch. \n\n## Actual Result\n\nImport error with latest version of werkzeug. I tried downgrading to a 2.3.X version of werkzeug and it ran without any issue. \n\n## Reproduction Steps\n\n``make ci``","body_prose":"When I run `make ci` on the main branch, it throws this import error with werkzeug\n\n [CODE] \n\n## Expected Result\n\nTo run make ci successfully on the main branch. \n\n## Actual Result\n\nImport error with latest version of werkzeug. I tried downgrading to a 2.3.X version of werkzeug and it ran without any issue. \n\n## Reproduction Steps\n\n``make ci``","text":"Import error with werkzeug. When I run `make ci` on the main branch, it throws this import error with werkzeug\n\n [CODE] \n\n## Expected Result\n\nTo run make ci successfully on the main branch. \n\n## Actual Result\n\nImport error with latest version of werkzeug. I tried downgrading to a 2.3.X version of werkzeug and it ran without any issue. \n\n## Reproduction Steps\n\n``make ci``","comments":["This is being tracked in psf\/httpbin"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-11-05T07:13:53Z","closed_at":"2023-11-05T11:30:32Z","updated_at":"2024-11-05T00:04:28Z","days_to_close":0.18,"created_year_month":"2023-11","labels":[],"issue_type":"bug","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":4.28,"reactions_total":0,"author_id":"user_0467","author_association":"CONTRIBUTOR","comment_author_ids":["user_0028"],"comment_author_roles":["CONTRIBUTOR"],"comment_by_issue_author":[false],"has_code_block":true,"has_traceback":false,"title_words":4,"body_words":59,"locked":true}
{"number":6567,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6567","title":"Requests doesn't work on emscripten \/ webassembly","body_clean":"This is maybe verging on a feature request, I'm not sure...\n\nWebassembly with emscripten is now an official python platform. However because it runs inside a browser sandbox environment, networking doesn't work normally, and hence nothing in requests works at all. However there is easy access to http(s) requests via the environment it is running in.\n\nRight now, we have a monkeypatch module which patches a new BaseAdapter subclass into `Session.__init__` (see link below).\n\n[URL]\n\nIt isn't masses of code, because most of the stuff that is handled by lower level things in requests is just passed directly off to the browser fetch. \n\nIt would be really nice if a version of this adapter could be added to requests (and the emscripten platform added to requests CI also, so we can see how much functionality works and how much doesn't.)\n\nI did a bunch of work on the monkeypatch code above, so I'd be happy to help on this, but obviously I don't want to spend the time doing a PR for it if it isn't going to have a chance of being merged, hence opening this issue to discuss.","body_prose":"This is maybe verging on a feature request, I'm not sure...\n\nWebassembly with emscripten is now an official python platform. However because it runs inside a browser sandbox environment, networking doesn't work normally, and hence nothing in requests works at all. However there is easy access to http(s) requests via the environment it is running in.\n\nRight now, we have a monkeypatch module which patches a new BaseAdapter subclass into `Session.__init__` (see link below).\n\n[URL]\n\nIt isn't masses of code, because most of the stuff that is handled by lower level things in requests is just passed directly off to the browser fetch. \n\nIt would be really nice if a version of this adapter could be added to requests (and the emscripten platform added to requests CI also, so we can see how much functionality works and how much doesn't.)\n\nI did a bunch of work on the monkeypatch code above, so I'd be happy to help on this, but obviously I don't want to spend the time doing a PR for it if it isn't going to have a chance of being merged, hence opening this issue to discuss.","text":"Requests doesn't work on emscripten \/ webassembly. This is maybe verging on a feature request, I'm not sure...\n\nWebassembly with emscripten is now an official python platform. However because it runs inside a browser sandbox environment, networking doesn't work normally, and hence nothing in requests works at all. However there is easy access to http(s) requests via the environment it is running in.\n\nRight now, we have a monkeypatch module which patches a new BaseAdapter subclass into `Session.__init__` (see link below).\n\n[URL]\n\nIt isn't masses of code, because most of the stuff that is handled by lower level things in requests is just passed directly off to the browser fetch. \n\nIt would be really nice if a version of this adapter could be added to requests (and the emscripten platform added to requests CI also, so we can see how much functionality works and how much doesn't.)\n\nI did a bunch of work on the monkeypatch code above, so I'd be happy to help on this, but obviously I don't want to spend the time doing a PR for it if it isn't going to have a chance of being merged, hence opening this issue to discuss.","comments":["Hey @[USER], thanks for opening this issue. We actually have a very similar issue on urllib3 (the underlying library of Requests) that has a bounty available. If you wanted to contribute there then many libraries would gain the ability to use WASM Python.\n\n[URL]","I'm going to close this one now that [URL] is closed, Emscripten support isn't stable yet but should be at least possible once urllib3 is released."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-11-05T19:23:45Z","closed_at":"2023-12-01T00:19:34Z","updated_at":"2024-12-28T00:04:13Z","days_to_close":25.21,"created_year_month":"2023-11","labels":[],"issue_type":"bug","comments_reported":2,"n_comments_collected":2,"comments_complete":true,"maintainer_replied":true,"hours_to_first_response":1.16,"reactions_total":0,"author_id":"user_0466","author_association":"NONE","comment_author_ids":["user_0141","user_0141"],"comment_author_roles":["MEMBER","MEMBER"],"comment_by_issue_author":[false,false],"has_code_block":false,"has_traceback":false,"title_words":7,"body_words":190,"locked":true}
{"number":6569,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6569","title":"HTTPSConnectionPool(port=443): Max retries exceeded with url:(Caused by SSLError(SSLZeroReturnError(6, 'TLS\/SSL connection has been closed (EOF) (_ssl.c:1129)')))","body_clean":"I having a long lasting problem with my request connection is getting shutdown using Cloud Run. I couldnt solve it yet so here I am to get support.\n\nHere is the full error:\n```\nError occurred: HTTPSConnectionPool(host='google.serper.dev', port=443): Max retries exceeded with url: \/search (Caused by SSLError(SSLZeroReturnError(6, 'TLS\/SSL connection has been closed (EOF) (_ssl.c:1129)')))\n```\n\nHere is how I use request:\n\n```\ndef serper_search(self, arguments):\n query = arguments[\"q\"]\n url = \"[URL]\n payload = json.dumps({\"q\": query})\n headers = {\n 'X-API-KEY': self.api_key,\n 'Content-Type': 'application\/json'\n }\n\n try:\n response = requests.request(\n \"POST\", url, headers=headers, data=payload)\n # Will raise an HTTPError if the HTTP request returned an unsuccessful status code\n response.raise_for_status()\n\n # Parse the response and make it ready \n parsed_response = self.parse_response(response, number_of_results=3)\n return parsed_response # Assuming the response content is in JSON format\n except requests.exceptions.HTTPError as http_err:\n logger.error(f\"HTTP error occurred: {http_err}\")\n return None\n except Exception as e:\n logger.error(f\"Error occurred: {e}\")\n return None\n\n```\n\nThis only happens in Cloud Run although the error should be on those side, there must a setting to override this issue on the request side as well. \n\n**I tried:**\n- verify = False\n\ndidnt help.\n\n**More info:**\nAlso I use this with fastapi and adding as a backgroundTask.\nfastapi==0.103.1\nrequests==2.31.0","body_prose":"I having a long lasting problem with my request connection is getting shutdown using Cloud Run. I couldnt solve it yet so here I am to get support.\n\nHere is the full error:\n [CODE] \n\nHere is how I use request:\n\n [CODE] \n\nThis only happens in Cloud Run although the error should be on those side, there must a setting to override this issue on the request side as well. \n\n**I tried:**\n- verify = False\n\ndidnt help.\n\n**More info:**\nAlso I use this with fastapi and adding as a backgroundTask.\nfastapi==0.103.1\nrequests==2.31.0","text":"HTTPSConnectionPool(port=443): Max retries exceeded with url:(Caused by SSLError(SSLZeroReturnError(6, 'TLS\/SSL connection has been closed (EOF) (_ssl.c:1129)'))). I having a long lasting problem with my request connection is getting shutdown using Cloud Run. I couldnt solve it yet so here I am to get support.\n\nHere is the full error:\n [CODE] \n\nHere is how I use request:\n\n [CODE] \n\nThis only happens in Cloud Run although the error should be on those side, there must a setting to override this issue on the request side as well. \n\n**I tried:**\n- verify = False\n\ndidnt help.\n\n**More info:**\nAlso I use this with fastapi and adding as a backgroundTask.\nfastapi==0.103.1\nrequests==2.31.0","comments":["Saw your comment in:\n[URL]\n\nJust wanted to remind anyone reading that Cloud Run does not allocate CPU outside request unless the revision is explicitly configured to do so; here are the docs:\n\n[URL]\n\nand here's a sample:\n\n But it seems like for Session.close it is not the same. \n\nSo, for this particular case, an example that shows that a Session object can still be used after closing would be useful. Also, if we look at the number of views of this question (17K views), it shows that many developers might be facing the same issue, and having a code example (or clarification) in the documentation might be useful.\n\nHowever, I am not sure if this is the expected behavior or a bug because a part of the doc says, \n\n> ```\n> with requests.Session() as s:\n> s.get('[URL]\n> ```\n> \n> This will make sure the session is closed as soon as the with block is exited, even if unhandled exceptions occurred.\n\n \n\nBut when I tried the example code below, it showed that the session was still not closed.\n\n```\nuserName = {'username': 'JohnDoe'}\nlocation = {'location': 'XYZ'}\n\nsetCookieUrl = '[URL]\ngetCookieUrl = '[URL]\n\nwith requests.Session() as s:\n s.get(setCookieUrl, params=userName)\n s.get(setCookieUrl, params=location)\n r = s.get(getCookieUrl)\n print(r.text) # Prints the cookies\n\nr2 = s.get(getCookieUrl)\nprint(r2.text) # Still prints the same cookies\n```\nThus, the expected behavior should be misleading. This could be fixed by updating the quoted documentation sentence above and\/or adding an illustrative code example about expected behavior.\n\n> > * The method _**requests.cookies.RequestsCookieJar.set**_ has no examples in the documentation, but there are several questions in stackoverflow regarding this method. [Here]([URL] is an example.\n> \n> Again, an example here would look like what? This isn't users should be using often if at all. So what code example would be useful?\n> \n\n> StackOverflow is full of people doing things they shouldn't with this library's internals. That doesn't mean we should add documentation to help them do things that 99.9% of the time they don't need to care about.\n\nI agree with you that this method might not be used that often. \n\nMy intuition was that since this is a method that appears in the API reference documentation (rather than one that only appears in the source code), then we can expect that users will end up using it -- even if they should not. However, as you said, not every method deserves an example. Thus, my goal was to prioritize which methods need code examples (or clarifications) by looking at which ones users struggle with on Stack Overflow. I would love to hear your opinion on other prioritization mechanisms that make more sense to you."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-11-14T14:15:27Z","closed_at":"2023-11-17T10:31:49Z","updated_at":"2024-11-20T00:04:25Z","days_to_close":2.84,"created_year_month":"2023-11","labels":[],"issue_type":"documentation","comments_reported":3,"n_comments_collected":3,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":8.24,"reactions_total":0,"author_id":"user_0280","author_association":"NONE","comment_author_ids":["user_0028","user_0028","user_0280"],"comment_author_roles":["CONTRIBUTOR","CONTRIBUTOR","NONE"],"comment_by_issue_author":[false,false,true],"has_code_block":false,"has_traceback":false,"title_words":7,"body_words":188,"locked":true}
{"number":6573,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6573","title":"The connection does not close automatically; it is not possible to close the session manually in recent versions of requests.","body_clean":"## When it worked correctly.\nConfiguration:\nOS debian 10; \npython3.8; \nrequests=2.28.0; \nurllib=1.26.14\n\n1. \n`$python`\n```python\nimport requests\nr = requests.get(\"[URL]\n# After processing the request, the connection was automatically closed with the status TIME_WAIT.\n```\n2.\n`$python`\n```python\nimport requests\ns = requests.Session()\nr = s.get(\"[URL]\n# The connection is held until it is closed manually, the status is ESTABLISHED\n\ns.close() #The connection is closed successfully, status is TIME_WAIT\n```\n\n## Doesn't work correctly. Update libraries\nrequests=2.31.0;\nurllib3=2.1.0.\n\n1.\n`$python`\n```python\nimport requests\nr = requests.get(\"[URL]\n#The behavior is now different and the connection is not closed after it has been processed, the status is ESTABLISHED\nr.close() #Trying to close the connection manually also doesn't work\n#Console exit (ctrl+d) successfully closes connection, status is TIME_WAIT\n```\n\n2.\n`$python`\n```python\nimport requests\ns = requests.Session()\nr = s.get(\"[URL]\n# The connection is held until it is closed manually, the status is ESTABLISHED\n\ns.close()\nr.close() \n#forced attempt to close connection manually does not work, status is ESTABLISHED\n\n#The connection is closed only when the console exits.\n```\n\n**Thus, after library updates, the connection cannot be managed manually (closed), it stopped working.**","body_prose":"## When it worked correctly.\nConfiguration:\nOS debian 10; \npython3.8; \nrequests=2.28.0; \nurllib=1.26.14\n\n1. \n`$python`\n [CODE] \n2.\n`$python`\n [CODE] \n\n## Doesn't work correctly. Update libraries\nrequests=2.31.0;\nurllib3=2.1.0.\n\n1.\n`$python`\n [CODE] \n\n2.\n`$python`\n [CODE] \n\n**Thus, after library updates, the connection cannot be managed manually (closed), it stopped working.**","text":"The connection does not close automatically; it is not possible to close the session manually in recent versions of requests.. ## When it worked correctly.\nConfiguration:\nOS debian 10; \npython3.8; \nrequests=2.28.0; \nurllib=1.26.14\n\n1. \n`$python`\n [CODE] \n2.\n`$python`\n [CODE] \n\n## Doesn't work correctly. Update libraries\nrequests=2.31.0;\nurllib3=2.1.0.\n\n1.\n`$python`\n [CODE] \n\n2.\n`$python`\n [CODE] \n\n**Thus, after library updates, the connection cannot be managed manually (closed), it stopped working.**","comments":["Hi @[USER], can you help limit the scope of changes? Does this combination of dependencies produce the issue? If not, this is likely related to urllib3 2.x.\n\n```\nrequests=2.31.0\nurllib=1.26.14\n```","@[USER] HI!\n\nYes, I checked, this problem occurs due to urllib3.\nIn configuration:\nrequests=2.31.0\nurllib3=1.26.14\nThe connection is manually closed as usual.\n\nShould we open issues in urllib3 or will the requests developers do it? (requests is completely dependent on urllib3)\n\nupd.\n>related to urllib3 2.x.\n\nThis problem also occurs due to urllib3.\nIn configuration:\nrequests=2.31.0\nurllib=**1.26.18**\nThe connection is not closed either manually or after a request.","Rewrite the documentation, urllib3 behavior has changed. And it will confuse users of requests.\n\n> close()\nCloses all adapters and as such the session\n\n[doc]([URL]"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-11-15T08:30:36Z","closed_at":"2023-11-17T10:32:20Z","updated_at":"2024-11-17T00:04:47Z","days_to_close":2.08,"created_year_month":"2023-11","labels":[],"issue_type":"bug","comments_reported":3,"n_comments_collected":3,"comments_complete":true,"maintainer_replied":true,"hours_to_first_response":0.19,"reactions_total":0,"author_id":"user_0139","author_association":"NONE","comment_author_ids":["user_0007","user_0139","user_0139"],"comment_author_roles":["MEMBER","NONE","NONE"],"comment_by_issue_author":[false,true,true],"has_code_block":true,"has_traceback":false,"title_words":20,"body_words":46,"locked":true}
{"number":6575,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6575","title":"Requests post not working with long processing time.","body_clean":"Hello. \n\nI am creating server API using FASTAPI\/Uvicorn.\n\nI am processing files with big AI models that are slow to process. When the file is lower than 10 Mb, everything works fine. But when longer, it implies that it will take more than 3 minutes. By doing the request post, on large files, the post does not get the response. The server continues as the process and shows 200 OK. So on the server side, everything seems fine but the request keeps running and does not get the ok code neither the data back. If I don´t add a timeout it will keep forever. If I add the timeout, it gives the error because it did not get the response. \nI am running the server like this \n`uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload --timeout-keep-alive 600 --ws-ping-timeout 500`\nAdding a timeout keep alive of 600 seconds to make sure it can handle big files.\n\nNow when I do the request, it won´t work. Then I tested this to check when it loses connection\n\n`@[USER].post(\"\/pru\/\")\nasync def pru():\n print(\"Comenzamos\")\n time.sleep(275)\n return \"Devolucion \" + time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime())\n `\nAfter making a post request to \/pru\/ using a sleep timer, I found out that 275 seconds is the time threshold when requests loses connection with the server and does not get anything back. Anything lower works fine. \n\nNow, if I change the post to get, and I do it on Google Chrome browser, it works fine, even with 500 seconds.\n\nDoes anyone knows why the requests loses connection with the server or why it does not receives the message back from the server?\n\nI investigated more, and some people recommended using TCPKeepAliveAdapter and stream = True. but that works with GET but not with POST. I have it like this. \n\n`keep_alive = TCPKeepAliveAdapter(idle=5, count=60, interval=10)\ns = requests.Session()\ns.mount(\"[URL] keep_alive)\nr = s.post(url=\"[URL] files=archivo, stream=True,timeout=400)`\n\nAny advise? I don´t know what else to try.\n\nThanks in advance.","body_prose":"Hello. \n\nI am creating server API using FASTAPI\/Uvicorn.\n\nI am processing files with big AI models that are slow to process. When the file is lower than 10 Mb, everything works fine. But when longer, it implies that it will take more than 3 minutes. By doing the request post, on large files, the post does not get the response. The server continues as the process and shows 200 OK. So on the server side, everything seems fine but the request keeps running and does not get the ok code neither the data back. If I don´t add a timeout it will keep forever. If I add the timeout, it gives the error because it did not get the response. \nI am running the server like this \n`uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload --timeout-keep-alive 600 --ws-ping-timeout 500`\nAdding a timeout keep alive of 600 seconds to make sure it can handle big files.\n\nNow when I do the request, it won´t work. Then I tested this to check when it loses connection\n\n`@[USER].post(\"\/pru\/\")\nasync def pru():\n print(\"Comenzamos\")\n time.sleep(275)\n return \"Devolucion \" + time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime())\n `\nAfter making a post request to \/pru\/ using a sleep timer, I found out that 275 seconds is the time threshold when requests loses connection with the server and does not get anything back. Anything lower works fine. \n\nNow, if I change the post to get, and I do it on Google Chrome browser, it works fine, even with 500 seconds.\n\nDoes anyone knows why the requests loses connection with the server or why it does not receives the message back from the server?\n\nI investigated more, and some people recommended using TCPKeepAliveAdapter and stream = True. but that works with GET but not with POST. I have it like this. \n\n`keep_alive = TCPKeepAliveAdapter(idle=5, count=60, interval=10)\ns = requests.Session()\ns.mount(\"[URL] keep_alive)\nr = s.post(url=\"[URL] files=archivo, stream=True,timeout=400)`\n\nAny advise? I don´t know what else to try.\n\nThanks in advance.","text":"Requests post not working with long processing time.. Hello. \n\nI am creating server API using FASTAPI\/Uvicorn.\n\nI am processing files with big AI models that are slow to process. When the file is lower than 10 Mb, everything works fine. But when longer, it implies that it will take more than 3 minutes. By doing the request post, on large files, the post does not get the response. The server continues as the process and shows 200 OK. So on the server side, everything seems fine but the request keeps running and does not get the ok code neither the data back. If I don´t add a timeout it will keep forever. If I add the timeout, it gives the error because it did not get the response. \nI am running the server like this \n`uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload --timeout-keep-alive 600 --ws-ping-timeout 500`\nAdding a timeout keep alive of 600 seconds to make sure it can handle big files.\n\nNow when I do the request, it won´t work. Then I tested this to check when it loses connection\n\n`@[USER].post(\"\/pru\/\")\nasync def pru():\n print(\"Comenzamos\")\n time.sleep(275)\n return \"Devolucion \" + time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime())\n `\nAfter making a post request to \/pru\/ using a sleep timer, I found out that 275 seconds is the time threshold when requests loses connection with the server and does not get anything back. Anything lower works fine. \n\nNow, if I change the post to get, and I do it on Google Chrome browser, it works fine, even with 500 seconds.\n\nDoes anyone knows why the requests loses connection with the server or why it does not receives the message back from the server?\n\nI investigated more, and some people recommended using TCPKeepAliveAdapter and stream = True. but that works with GET but not with POST. I have it like this. \n\n`keep_alive = TCPKeepAliveAdapter(idle=5, count=60, interval=10)\ns = requests.Session()\ns.mount(\"[URL] keep_alive)\nr = s.post(url=\"[URL] files=archivo, stream=True,timeout=400)`\n\nAny advise? I don´t know what else to try.\n\nThanks in advance.","comments":["At the end the solution I found, if anyone needs it, was not on the client side but in the server side. Something underneath is closing the connection after 275 seconds, so the solution was to create function in a threding.Thread, while the process is alive. It sends text messages every 30 seconds. In that way, both sides know that the connection is alive. I tested with a 5 minutes process. I used StreamingResponse to make it happen.\n\n que = queue.Queue()\n def director():\n # Esta funcion se utiliza para poder enviar mensajes periodicamente cada 30 segundos\n # es necesaria para mantener la conexión activa con el cliente en archivos que requeren \n # más de 270 segundos para procesar\n resultado = \"\"\n t = Thread(target=lambda q, arg : q.put(trandia(arg)), args=(que, resultado,))\n t.start()\n while t.is_alive():\n t.join(30)\n yield \"#processing...#\"\n \n yield que.get()\n \n return StreamingResponse(director(), media_type='text\/event-stream')"],"state":"closed","state_reason":"not_planned","is_closed":true,"created_at":"2023-11-16T11:10:35Z","closed_at":"2023-11-29T12:12:19Z","updated_at":"2024-11-29T00:05:41Z","days_to_close":13.04,"created_year_month":"2023-11","labels":["Question\/Not a bug","actions\/autoclose-qa"],"issue_type":"question","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":null,"reactions_total":0,"author_id":"user_0279","author_association":"NONE","comment_author_ids":["user_0279"],"comment_author_roles":["NONE"],"comment_by_issue_author":[true],"has_code_block":false,"has_traceback":false,"title_words":8,"body_words":325,"locked":true}
{"number":6576,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6576","title":"Possible regression with how MaxRetryError is handled","body_clean":"Since requests does not retry failed connections, a somewhat confusion exception is encountered by doing something like this.\n```\n>>> requests.get('[URL]\n...\nrequests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=12121): Max retries exceeded with url: \/ (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))\n```\n\nI found in my searches about this exception that years ago this issue was reported and resolved in urllib3 by adding the ability to specify `retries=False` in the request: [URL]\n\nThe result of the change back then gave a nicer exception output: [URL]\n\nIs this a regression, and if possible, could there once again be a way to get a cleaner exception message for this case? Thank you.","body_prose":"Since requests does not retry failed connections, a somewhat confusion exception is encountered by doing something like this.\n [CODE] \n\nI found in my searches about this exception that years ago this issue was reported and resolved in urllib3 by adding the ability to specify `retries=False` in the request: [URL]\n\nThe result of the change back then gave a nicer exception output: [URL]\n\nIs this a regression, and if possible, could there once again be a way to get a cleaner exception message for this case? Thank you.","text":"Possible regression with how MaxRetryError is handled. Since requests does not retry failed connections, a somewhat confusion exception is encountered by doing something like this.\n [CODE] \n\nI found in my searches about this exception that years ago this issue was reported and resolved in urllib3 by adding the ability to specify `retries=False` in the request: [URL]\n\nThe result of the change back then gave a nicer exception output: [URL]\n\nIs this a regression, and if possible, could there once again be a way to get a cleaner exception message for this case? Thank you.","comments":["There is no regression here. That thread allows that for retries=False but requests always configures retries by default. You'll want to customize an HTTPAdapter to specify different behavior if you don't want to see a MaxRetryError in the exception message","So how many retries does requests configure? The docs say requests does not do any unless you use Session() [URL]\n\nAlso I tried configuring HTTPAdapter with max_retries=0 or max_retries=False and the exception did not change. Am I doing something incorrectly?\n\n```\nfrom requests import Session\nfrom requests.adapters import HTTPAdapter\n\ns = Session()\na = HTTPAdapter(max_retries=0)\ns.mount('[URL] a)\ns.get('[URL]\n```"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-11-16T21:07:04Z","closed_at":"2023-11-17T01:45:56Z","updated_at":"2024-11-17T00:04:48Z","days_to_close":0.19,"created_year_month":"2023-11","labels":[],"issue_type":"bug","comments_reported":2,"n_comments_collected":2,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":4.65,"reactions_total":0,"author_id":"user_0278","author_association":"NONE","comment_author_ids":["user_0028","user_0278"],"comment_author_roles":["CONTRIBUTOR","NONE"],"comment_by_issue_author":[false,true],"has_code_block":true,"has_traceback":false,"title_words":7,"body_words":87,"locked":true}
{"number":6577,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6577","title":"Improper URL serialization of boolean GET parameters","body_clean":"Constructing a GET request with a boolean parameter `foo` set to `True` results in `&foo=True` being appended to the URL path, instead of just `&foo`. This makes it inoperable with some APIs (such as the [NIST CVE API]([URL] that return an error when a string value is set for a boolean GET parameter.\n\nExample:\n```py\n>>> import requests\n>>> API_URL = \"[URL]\n>>> res = requests.get(API_URL, params={\"noRejected\": True})\n>>> res\n\n>>> res.headers[\"message\"]\n'noRejected parameter cannot have a value.'\n```\n\nIt's a mystery to me how such a basic feature of the de-facto standard library for making HTTP requests in Python hasn't yet been addressed and I would greatly appreciate if it could be fixed, or at least if a special value\/object was added that could be passed as a value in `params` to produce the expected result. Working around this limitation by constructing the URL with all its parameters myself as a programmer does not inspire confidence in the security and correctness of the code.\n\n## Expected Result\n\n```py\n>>> res.request.path_url\n'\/rest\/json\/cves\/2.0?noRejected'\n```\n\n## Actual Result\n\n```py\n>>> res.request.path_url\n'\/rest\/json\/cves\/2.0?noRejected=True'\n```\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{\n \"chardet\": {\n \"version\": \"5.1.0\"\n },\n \"charset_normalizer\": {\n \"version\": \"3.0.1\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.3\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.11.2\"\n },\n \"platform\": {\n \"release\": \"6.1.0-13-amd64\",\n \"system\": \"Linux\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.28.1\"\n },\n \"system_ssl\": {\n \"version\": \"300000b0\"\n },\n \"urllib3\": {\n \"version\": \"1.26.12\"\n },\n \"using_charset_normalizer\": false,\n \"using_pyopenssl\": false\n}\n```","body_prose":"Constructing a GET request with a boolean parameter `foo` set to `True` results in `&foo=True` being appended to the URL path, instead of just `&foo`. This makes it inoperable with some APIs (such as the [NIST CVE API]([URL] that return an error when a string value is set for a boolean GET parameter.\n\nExample:\n [CODE] \n\nIt's a mystery to me how such a basic feature of the de-facto standard library for making HTTP requests in Python hasn't yet been addressed and I would greatly appreciate if it could be fixed, or at least if a special value\/object was added that could be passed as a value in `params` to produce the expected result. Working around this limitation by constructing the URL with all its parameters myself as a programmer does not inspire confidence in the security and correctness of the code.\n\n## Expected Result\n\n [CODE] \n\n## Actual Result\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"Improper URL serialization of boolean GET parameters. Constructing a GET request with a boolean parameter `foo` set to `True` results in `&foo=True` being appended to the URL path, instead of just `&foo`. This makes it inoperable with some APIs (such as the [NIST CVE API]([URL] that return an error when a string value is set for a boolean GET parameter.\n\nExample:\n [CODE] \n\nIt's a mystery to me how such a basic feature of the de-facto standard library for making HTTP requests in Python hasn't yet been addressed and I would greatly appreciate if it could be fixed, or at least if a special value\/object was added that could be passed as a value in `params` to produce the expected result. Working around this limitation by constructing the URL with all its parameters myself as a programmer does not inspire confidence in the security and correctness of the code.\n\n## Expected Result\n\n [CODE] \n\n## Actual Result\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["In the future, please search **closed and** open issues before creating new ones that are duplicates.","> In the future, please search **closed and** open issues before creating new ones that are duplicates.\n\nWhat makes you think I haven't done that? Instead of lecturing me, the minimum you can do is provide a link or an ID. @[USER]"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-11-17T22:36:19Z","closed_at":"2023-11-18T01:05:00Z","updated_at":"2024-11-18T00:04:47Z","days_to_close":0.1,"created_year_month":"2023-11","labels":[],"issue_type":"other","comments_reported":2,"n_comments_collected":2,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":2.48,"reactions_total":0,"author_id":"user_0277","author_association":"NONE","comment_author_ids":["user_0028","user_0277"],"comment_author_roles":["CONTRIBUTOR","NONE"],"comment_by_issue_author":[false,true],"has_code_block":true,"has_traceback":false,"title_words":7,"body_words":157,"locked":true}
{"number":6578,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6578","title":"Weird behaviour with https and proxy authentication","body_clean":"requests.get is getting weird with some combinations of dictionary keys and proxy authentication.\n\n## Expected Result\n```python\nprint(requests.get('[URL] proxies={\"https\" : '[URL]\n```\nOutput:\n``\n \n\n## Actual Result\nDoesn't run? (Maybe timeout)\nBut it somehow fixes itself with these changes\n```python\nprint(requests.get('[URL] proxies={\"http\" : '[URL]\n```\n\nOutput:\n``\n \n\n## Reproduction Steps\n\n```python\nimport requests\n\nprint(requests.get('[URL] proxies={\"https\" : '[URL]\n\nprint(requests.get('[URL] proxies={\"http\" : '[URL]\n```\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"2.0.12\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.4\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.10.11\"\n },\n \"platform\": {\n \"release\": \"10\",\n \"system\": \"Windows\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.27.1\"\n },\n \"system_ssl\": {\n \"version\": \"1010114f\"\n },\n \"urllib3\": {\n \"version\": \"1.26.9\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}\n````\n $ python --version\n Python 3.10.11","body_prose":"requests.get is getting weird with some combinations of dictionary keys and proxy authentication.\n\n## Expected Result\n [CODE] \nOutput:\n``\n \n\n## Actual Result\nDoesn't run? (Maybe timeout)\nBut it somehow fixes itself with these changes\n [CODE] \n\nOutput:\n``\n \n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE] `\n $ python --version\n Python 3.10.11","text":"Weird behaviour with https and proxy authentication. requests.get is getting weird with some combinations of dictionary keys and proxy authentication.\n\n## Expected Result\n [CODE] \nOutput:\n``\n \n\n## Actual Result\nDoesn't run? (Maybe timeout)\nBut it somehow fixes itself with these changes\n [CODE] \n\nOutput:\n``\n \n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE] `\n $ python --version\n Python 3.10.11","comments":["proxies im using are https capable","misclick","its most likely that your proxies only support http protocol, it should work the way you have it, so its probably proxy issues.","> proxies im using are https capable\n\n> its most likely that your proxies only support http protocol, it should work the way you have it, so its probably proxy issues.","I don't think there's enough information here to provide feedback. It seems you're hitting a proxy with https and not getting a response (hence the timeout). To be clear, having a proxy that can tunnel HTTPS requests and having a proxy that can be connected to over HTTPS are different things.\n\nI'm going to close this given its age and the lack of information."],"state":"closed","state_reason":"not_planned","is_closed":true,"created_at":"2023-11-19T00:56:06Z","closed_at":"2026-04-04T19:08:21Z","updated_at":"2026-04-04T19:08:21Z","days_to_close":867.76,"created_year_month":"2023-11","labels":[],"issue_type":"other","comments_reported":5,"n_comments_collected":5,"comments_complete":true,"maintainer_replied":true,"hours_to_first_response":96.16,"reactions_total":0,"author_id":"user_0275","author_association":"NONE","comment_author_ids":["user_0275","user_0275","user_0276","user_0275","user_0007"],"comment_author_roles":["NONE","NONE","NONE","NONE","MEMBER"],"comment_by_issue_author":[true,true,false,true,false],"has_code_block":true,"has_traceback":false,"title_words":7,"body_words":57,"locked":false}
{"number":6582,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6582","title":"\"Recommended Packages and Extensions\" page asyncio recommendations are outdated","body_clean":"While looking for an asyncio compatible recommendation for requests, I stumbled on the [documentation]([URL] provided by the project. It recommends Request-Threads, which does not seem to be actively developed (no new changes\/releases in the past 5 years). txrequests is an alternative Twisted-based package that seems to be more recommended these days: [URL] .\n\nMoreover, requests.Async is not mentioned; this support was moved to [URL] (mentioned in History.md). [1]\n\n1. Note to other readers: gevent-requests is the library that requires gevent\/greenlet and achieves asynchronous processing via green threads: it doesn't achieve this via native python asyncio coroutines.","body_prose":"While looking for an asyncio compatible recommendation for requests, I stumbled on the [documentation]([URL] provided by the project. It recommends Request-Threads, which does not seem to be actively developed (no new changes\/releases in the past 5 years). txrequests is an alternative Twisted-based package that seems to be more recommended these days: [URL] .\n\nMoreover, requests.Async is not mentioned; this support was moved to [URL] (mentioned in History.md). [1]\n\n1. Note to other readers: gevent-requests is the library that requires gevent\/greenlet and achieves asynchronous processing via green threads: it doesn't achieve this via native python asyncio coroutines.","text":"\"Recommended Packages and Extensions\" page asyncio recommendations are outdated. While looking for an asyncio compatible recommendation for requests, I stumbled on the [documentation]([URL] provided by the project. It recommends Request-Threads, which does not seem to be actively developed (no new changes\/releases in the past 5 years). txrequests is an alternative Twisted-based package that seems to be more recommended these days: [URL] .\n\nMoreover, requests.Async is not mentioned; this support was moved to [URL] (mentioned in History.md). [1]\n\n1. Note to other readers: gevent-requests is the library that requires gevent\/greenlet and achieves asynchronous processing via green threads: it doesn't achieve this via native python asyncio coroutines.","comments":[],"state":"open","state_reason":null,"is_closed":false,"created_at":"2023-11-23T20:41:53Z","closed_at":null,"updated_at":"2023-12-28T02:07:05Z","days_to_close":null,"created_year_month":"2023-11","labels":[],"issue_type":"other","comments_reported":0,"n_comments_collected":0,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":null,"reactions_total":0,"author_id":"user_0463","author_association":"NONE","comment_author_ids":[],"comment_author_roles":[],"comment_by_issue_author":[],"has_code_block":false,"has_traceback":false,"title_words":9,"body_words":96,"locked":false}
{"number":6584,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6584","title":"Status Code 425 named incorrectly","body_clean":"HTTP status code 425 is defined as \"too early\". While the defining RFC defines the code in the context of TLS, I regularly find APIs that use this status code to indicate to a client that an asynchronous job that has been started is still being processed, so the result can not yet be provided.\n\nrequests.status_codes however doesn't know the reason \"too early\", and instead calls 425 \"unordered_collection\" and \"unordered\". I believe, this is a bug.\n\nThe defendent: [URL]\n\nI call to the witness stand:\n* [URL]\n* [URL]\n* [URL]\n\n## Expected Result\n>>> requests.codes.get(\"TOO_EARLY\")\n425\n## Actual Result\n>>> requests.codes.get(\"TOO_EARLY\")\n\n## Reproduction Steps\n\n```python\nimport requests\n```\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"3.3.0\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.4\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.11.6\"\n },\n \"platform\": {\n \"release\": \"6.6.1-arch1-1\",\n \"system\": \"Linux\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"30100040\"\n },\n \"urllib3\": {\n \"version\": \"2.0.7\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}\n\n```","body_prose":"HTTP status code 425 is defined as \"too early\". While the defining RFC defines the code in the context of TLS, I regularly find APIs that use this status code to indicate to a client that an asynchronous job that has been started is still being processed, so the result can not yet be provided.\n\nrequests.status_codes however doesn't know the reason \"too early\", and instead calls 425 \"unordered_collection\" and \"unordered\". I believe, this is a bug.\n\nThe defendent: [URL]\n\nI call to the witness stand:\n* [URL]\n* [URL]\n* [URL]\n\n## Expected Result\n>>> requests.codes.get(\"TOO_EARLY\")\n425\n## Actual Result\n>>> requests.codes.get(\"TOO_EARLY\")\n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"Status Code 425 named incorrectly. HTTP status code 425 is defined as \"too early\". While the defining RFC defines the code in the context of TLS, I regularly find APIs that use this status code to indicate to a client that an asynchronous job that has been started is still being processed, so the result can not yet be provided.\n\nrequests.status_codes however doesn't know the reason \"too early\", and instead calls 425 \"unordered_collection\" and \"unordered\". I believe, this is a bug.\n\nThe defendent: [URL]\n\nI call to the witness stand:\n* [URL]\n* [URL]\n* [URL]\n\n## Expected Result\n>>> requests.codes.get(\"TOO_EARLY\")\n425\n## Actual Result\n>>> requests.codes.get(\"TOO_EARLY\")\n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["I would merge a change to add that to the type definition. Keep in mind unordered was in wide use before that rfc though which is why it has that definition. I doubt anyone is using it from us but we can't remove it.","Implementing this in an upcoming PR.","Here is a PR with relevant changes that I believe are backwards compatible and generalizable. Could you take a look and give your initial thoughts? @[USER]","Resolving now that #6592 is merged."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-11-24T20:53:31Z","closed_at":"2023-12-20T06:33:10Z","updated_at":"2024-12-22T00:04:54Z","days_to_close":25.4,"created_year_month":"2023-11","labels":[],"issue_type":"bug","comments_reported":4,"n_comments_collected":4,"comments_complete":true,"maintainer_replied":true,"hours_to_first_response":5.75,"reactions_total":0,"author_id":"user_0462","author_association":"NONE","comment_author_ids":["user_0028","user_0274","user_0274","user_0007"],"comment_author_roles":["CONTRIBUTOR","CONTRIBUTOR","CONTRIBUTOR","MEMBER"],"comment_by_issue_author":[false,false,false,false],"has_code_block":true,"has_traceback":false,"title_words":5,"body_words":114,"locked":true}
{"number":6585,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6585","title":"(Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 400 Bad Request')))","body_clean":"I'm developing a program that scrapes news data using the requests library but while running I get this error. my proxy list is working correctly \n\nerror: Proxy: 103.21.244.100:80 - Error: HTTPSConnectionPool(host='www.nytimes.com', port=443): Max retries exceeded with url: \/section\/business\/media (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 400 Bad Request')))\n\n[proxylist.txt]([URL]\n\n## Reproduction Steps\n\n```python\nimport sys\nimport time\nimport psycopg2\nimport newspaper\nfrom PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton\nfrom threading import Thread\nimport requests\n\nclass NewsScraperGUI(QMainWindow):\n def __init__(self):\n super().__init__()\n self.initUI()\n self.scraping = False # Flag to control scraping process\n\n def initUI(self):\n self.setWindowTitle('News Scraper')\n self.setGeometry(100, 100, 400, 200)\n\n self.start_button = QPushButton('Start Scraping', self)\n self.start_button.clicked.connect(self.startScraping)\n self.start_button.setGeometry(50, 50, 150, 30)\n\n self.stop_button = QPushButton('Stop Scraping', self)\n self.stop_button.clicked.connect(self.stopScraping)\n self.stop_button.setGeometry(200, 50, 150, 30)\n self.stop_button.setEnabled(False) # Initially disabled\n\n def create_table(self):\n conn = psycopg2.connect(\n dbname='postgres',\n user='postgres',\n password='12Tilak34##',\n host='localhost'\n )\n cur = conn.cursor()\n cur.execute('''\n CREATE TABLE IF NOT EXISTS news (\n id SERIAL PRIMARY KEY,\n source TEXT,\n title TEXT,\n text TEXT,\n url TEXT\n );\n ''')\n conn.commit()\n conn.close()\n\n def insert_news(self, source, title, text, url):\n conn = psycopg2.connect(\n dbname='postgres',\n user='postgres',\n password='12Tilak34##',\n host='localhost'\n )\n cur = conn.cursor()\n cur.execute('''\n INSERT INTO news (source, title, text, url) VALUES (%s, %s, %s, %s);\n ''', (source, title, text, url))\n conn.commit()\n conn.close()\n\n def read_proxies(self, filename):\n try:\n with open(filename, 'r') as file:\n proxies = file.readlines()\n # Removing newline characters and any extra whitespace\n proxies = [proxy.strip() for proxy in proxies if proxy.strip()]\n return proxies\n except Exception as e:\n print(f\"Error reading proxies from file: {e}\")\n return []\n def scrape_news(self, source_url, num_articles, proxies_filename):\n proxies = self.read_proxies(proxies_filename)\n\n try:\n source = newspaper.build(source_url, memoize_articles=False)\n source.download()\n source.parse()\n\n articles_scraped = 0\n for article in source.articles:\n if articles_scraped >= num_articles:\n break\n\n proxy = proxies.pop(0) if proxies else None # Get the first proxy from the list\n if proxy:\n proxies.append(proxy) # Rotate proxies\n\n article_url = article.url\n article_title = article.title\n article_text = article.text\n\n try:\n if proxy:\n # Using requests library to send the request with the selected proxy\n response = requests.get(article_url, proxies={\"http\": proxy, \"https\": proxy}, timeout=10)\n\n if response.status_code == 200:\n # If the request was successful, insert news and print proxy used\n self.insert_news(source_url, article_title, article_text, article_url)\n print(f\"Proxy: {proxy} - Success: {article_url}\")\n else:\n print(f\"Proxy: {proxy} - Failed: {article_url}\")\n\n else:\n print(\"No proxy available for request.\")\n\n except Exception as e:\n print(f\"Proxy: {proxy} - Error: {e}\")\n\n articles_scraped += 1\n\n except Exception as e:\n print(f\"Error scraping from {source_url}: {e}\")\n\n def startScraping(self):\n self.scraping = True\n self.start_button.setEnabled(False)\n self.stop_button.setEnabled(True)\n\n self.create_table()\n proxies_filename = \"proxylist.txt\"\n\n # Define websites and the number of articles to scrape from each\n websites = [\n {'url': '[URL] 'num_articles': 5},\n {'url': '[URL] 'num_articles': 5},\n {'url': '[URL] 'num_articles': 5},\n {'url': '[URL] 'num_articles': 5},\n ]\n\n self.threads = []\n for site in websites:\n thread = Thread(target=self.scrape_news, args=(site['url'], site['num_articles'],proxies_filename))\n self.threads.append(thread)\n thread.start()\n\n def stopScraping(self):\n self.scraping = False\n self.start_button.setEnabled(True)\n self.stop_button.setEnabled(False)\n\n for thread in self.threads:\n thread.join()\n\ndef main():\n app = QApplication(sys.argv)\n window = NewsScraperGUI()\n window.show()\n sys.exit(app.exec_())\n\nif __name__ == '__main__':\n main()\n\n```\n\n## System Information\n\n $ python -m requests.help\n\n```json\nC:\\Python\\Lib\\site-packages\\requests\\__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.15) or chardet (5.2.0)\/charset_normalizer (2.0.12) doesn't match a supported version!\n warnings.warn(\"urllib3 ({}) or chardet ({})\/charset_normalizer ({}) doesn't match a supported \"\nC:\\Python\\Lib\\site-packages\\requests\\help.py:25: DeprecationWarning: 'urllib3.contrib.pyopenssl' module is deprecated and will be removed in a future release of urllib3 2.x. Read more in this issue: [URL]\n from urllib3.contrib import pyopenssl\n{\n \"chardet\": {\n \"version\": \"5.2.0\"\n },\n \"charset_normalizer\": {\n \"version\": \"2.0.12\"\n },\n \"cryptography\": {\n \"version\": \"41.0.1\"\n },\n \"idna\": {\n \"version\": \"3.4\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.11.3\"\n },\n \"platform\": {\n \"release\": \"10\",\n \"system\": \"Windows\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"30100010\",\n \"version\": \"23.2.0\"\n },\n \"requests\": {\n \"version\": \"2.26.0\"\n },\n \"system_ssl\": {\n \"version\": \"1010114f\"\n },\n \"urllib3\": {\n \"version\": \"1.26.15\"\n },\n \"using_charset_normalizer\": false,\n \"using_pyopenssl\": true\n}\n```","body_prose":"I'm developing a program that scrapes news data using the requests library but while running I get this error. my proxy list is working correctly \n\nerror: Proxy: 103.21.244.100:80 - Error: HTTPSConnectionPool(host='www.nytimes.com', port=443): Max retries exceeded with url: \/section\/business\/media (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 400 Bad Request')))\n\n[proxylist.txt]([URL]\n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"(Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 400 Bad Request'))). I'm developing a program that scrapes news data using the requests library but while running I get this error. my proxy list is working correctly \n\nerror: Proxy: 103.21.244.100:80 - Error: HTTPSConnectionPool(host='www.nytimes.com', port=443): Max retries exceeded with url: \/section\/business\/media (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 400 Bad Request')))\n\n[proxylist.txt]([URL]\n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["Hi @[USER], it looks like this may be a request for assistance rather than a bug in Requests. We're returning an error showing we're unable to connect to your proxy as it's currently been configured. We'd recommend posting on [StackOverflow]([URL] for help with general usage\/configuration issues. We try to reserve the GitHub issue tracker for bug reports. Thanks!"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-11-26T06:22:50Z","closed_at":"2024-05-15T20:06:06Z","updated_at":"2025-05-16T00:04:54Z","days_to_close":171.57,"created_year_month":"2023-11","labels":[],"issue_type":"bug","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":true,"hours_to_first_response":4117.72,"reactions_total":0,"author_id":"user_0461","author_association":"NONE","comment_author_ids":["user_0007"],"comment_author_roles":["MEMBER"],"comment_by_issue_author":[false],"has_code_block":true,"has_traceback":false,"title_words":12,"body_words":63,"locked":true}
{"number":6586,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6586","title":"The Content-Length header for string `data` counts Unicode characters in the string when it should count encoded bytes","body_clean":"A call like this:\n\n```python\nresponse = requests.post(\"[URL] data=\"👍👎\")\n```\n\nauto sets the `Content-Length` header in the request to `2` when it should be `8`.\n\nI hit this issue was making a request with a JSON body to a service I own (running behind AWS API Gateway) and having the service complain that there was no closing brace `}` in the JSON body. I was passing the JSON body into requests as a string to the `data` argument. It turns out that API Gateway ignores any body bytes beyond the `Content-Length` in the request. Turning up detailed logging on API Gateway, I can see the request headers and realized the value in the `Content-Length` header didn't match the number of bytes in the body.\n\nA quick workaround is to encode the string into bytes before passing it into Requests.\n\nThis produces a Content-Length header with the correct value of `8`:\n\n```python\nresponse = requests.post(\"[URL] data=\"👍👎\".encode(\"utf-8\"))\n```\n\n## Expected Result\n\nOn a server receiving a POST from Requests, I expect the `Content-Length` header value to match the number of bytes in the body of the request. See [RFC 9110]([URL]\n\n## Actual Result\n\nIn the specific case where Request's `data` argument is set as a string containing characters which encode into multi-byte UTF-8, the value in the `Content-Length` header is incorrect. Requests appears to be counting the number of Unicode characters in the string instead of the number of bytes that will be sent to the server.\n\n## Reproduction Steps\n\n```python\n>>> import requests\n>>> thumbs_up_down = \"👍👎\"\n>>> len(thumbs_up_down)\n2\n>>> len(thumbs_up_down.encode())\n8\n>>> pending_request = requests.Request(\"POST\", \"[URL] data=thumbs_up_down)\n>>> prepared_request = pending_request.prepare()\n>>> prepared_request.headers\n{'Content-Length': '2'}\n```\n\nI opened a pull request, #6587, that adds a failing unit test that demonstrates this problem.\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"3.3.2\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.6\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.9.16\"\n },\n \"platform\": {\n \"release\": \"23.1.0\",\n \"system\": \"Darwin\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"1010111f\"\n },\n \"urllib3\": {\n \"version\": \"2.1.0\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}\n```","body_prose":"A call like this:\n\n [CODE] \n\nauto sets the `Content-Length` header in the request to `2` when it should be `8`.\n\nI hit this issue was making a request with a JSON body to a service I own (running behind AWS API Gateway) and having the service complain that there was no closing brace `}` in the JSON body. I was passing the JSON body into requests as a string to the `data` argument. It turns out that API Gateway ignores any body bytes beyond the `Content-Length` in the request. Turning up detailed logging on API Gateway, I can see the request headers and realized the value in the `Content-Length` header didn't match the number of bytes in the body.\n\nA quick workaround is to encode the string into bytes before passing it into Requests.\n\nThis produces a Content-Length header with the correct value of `8`:\n\n [CODE] \n\n## Expected Result\n\nOn a server receiving a POST from Requests, I expect the `Content-Length` header value to match the number of bytes in the body of the request. See [RFC 9110]([URL]\n\n## Actual Result\n\nIn the specific case where Request's `data` argument is set as a string containing characters which encode into multi-byte UTF-8, the value in the `Content-Length` header is incorrect. Requests appears to be counting the number of Unicode characters in the string instead of the number of bytes that will be sent to the server.\n\n## Reproduction Steps\n\n [CODE] \n\nI opened a pull request, #6587, that adds a failing unit test that demonstrates this problem.\n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"The Content-Length header for string `data` counts Unicode characters in the string when it should count encoded bytes. A call like this:\n\n [CODE] \n\nauto sets the `Content-Length` header in the request to `2` when it should be `8`.\n\nI hit this issue was making a request with a JSON body to a service I own (running behind AWS API Gateway) and having the service complain that there was no closing brace `}` in the JSON body. I was passing the JSON body into requests as a string to the `data` argument. It turns out that API Gateway ignores any body bytes beyond the `Content-Length` in the request. Turning up detailed logging on API Gateway, I can see the request headers and realized the value in the `Content-Length` header didn't match the number of bytes in the body.\n\nA quick workaround is to encode the string into bytes before passing it into Requests.\n\nThis produces a Content-Length header with the correct value of `8`:\n\n [CODE] \n\n## Expected Result\n\nOn a server receiving a POST from Requests, I expect the `Content-Length` header value to match the number of bytes in the body of the request. See [RFC 9110]([URL]\n\n## Actual Result\n\nIn the specific case where Request's `data` argument is set as a string containing characters which encode into multi-byte UTF-8, the value in the `Content-Length` header is incorrect. Requests appears to be counting the number of Unicode characters in the string instead of the number of bytes that will be sent to the server.\n\n## Reproduction Steps\n\n [CODE] \n\nI opened a pull request, #6587, that adds a failing unit test that demonstrates this problem.\n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["I assume that it is incorrect to require the data to be encoded as UTF-8, so I will work on a fix that removes the need for this hack. @[USER]","> I assume that it is incorrect to require the data to be encoded as UTF-8, so I will work on a fix that removes the need for this hack. @[USER]\n\nI do not understand what you are saying. What hack?\n\nA Python string can contain Unicode characters. To send a Python string as the body of an HTTP request, the string needs to be encoded into bytes. UTF-8 is a common encoding (and I see signs of UTF-8 being assumed elsewhere in the Requests code). In the behavior I saw in the wild, Requests did, in fact, encode the request body as UTF-8.","Ah! Your pull request lines up with how I thought this might be properly addressed! Nice! (I just created a similar pull request #6589.)","> I do not understand what you are saying. What hack?\n\nHa, looks like we made the same conclusion here. What I meant regarding the \"hack\" was requiring the user to encode their string data as UTF-8 for the Content-Length header to be correctly initialized.","Can I fix this by downgrading to a previous version? I don't want to (and some users probably cannot) change the code to convert to bytes before passing it to the request.\n\nAlso don't really get your fixes, the body is at some point converted to bytes (there is a `body_to_chunks` in request.py) that also seems to set the content-length header? But that is just a side note, I'm not into the code, so just ignore it if I'm talking nonsense..","Bytes are the language of the Internet regardless of whether you think that. Many things try to paper over that. The right thing is to typically send bytes that you know how they should be encoded but barring that, we should be always dealing with bytes internally. Now that we dropped 2.7 support, I'd support always encoding data parameters that are strs to bytes before doing anything else with them (e.g., calculating content length) internally","Fixed by #6589"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-11-27T22:31:09Z","closed_at":"2024-02-23T01:47:24Z","updated_at":"2025-02-23T00:04:47Z","days_to_close":87.14,"created_year_month":"2023-11","labels":[],"issue_type":"other","comments_reported":7,"n_comments_collected":7,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":19.57,"reactions_total":1,"author_id":"user_0272","author_association":"CONTRIBUTOR","comment_author_ids":["user_0271","user_0272","user_0272","user_0271","user_0273","user_0028","user_0272"],"comment_author_roles":["NONE","CONTRIBUTOR","CONTRIBUTOR","NONE","NONE","CONTRIBUTOR","CONTRIBUTOR"],"comment_by_issue_author":[false,true,true,false,false,false,true],"has_code_block":true,"has_traceback":false,"title_words":18,"body_words":263,"locked":true}
{"number":6588,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6588","title":"Cannot run tests locally","body_clean":"I am trying to install the repository and run all the tests as recommended by the [Contribution Instructions]([URL] I am getting the following error when I perform the following. Importantly, what are the official instructions for installing the dev dependencies for `requests`? I cannot find an official instruction so I'm using the `Makefile`.\n\n## Expected Result\n\n```\nPytest to run successfully.\n```\n\n## Actual Result\n```\nImportError: cannot import name 'parse_authorization_header' from 'werkzeug.http' (\/requests\/venv\/lib\/python3.10\/site-packages\/werkzeug\/http.py)\n```\n## Reproduction Steps\n\n```\ncd requests\npython -m venv .\/myvenv\nmake init\npytest tests\/\n```\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"3.3.2\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.6\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.10.11\"\n },\n \"platform\": {\n \"release\": \"22.4.0\",\n \"system\": \"Darwin\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"1010114f\"\n },\n \"urllib3\": {\n \"version\": \"2.1.0\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}\n```","body_prose":"I am trying to install the repository and run all the tests as recommended by the [Contribution Instructions]([URL] I am getting the following error when I perform the following. Importantly, what are the official instructions for installing the dev dependencies for `requests`? I cannot find an official instruction so I'm using the `Makefile`.\n\n## Expected Result\n\n [CODE] \n\n## Actual Result\n [CODE] \n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"Cannot run tests locally. I am trying to install the repository and run all the tests as recommended by the [Contribution Instructions]([URL] I am getting the following error when I perform the following. Importantly, what are the official instructions for installing the dev dependencies for `requests`? I cannot find an official instruction so I'm using the `Makefile`.\n\n## Expected Result\n\n [CODE] \n\n## Actual Result\n [CODE] \n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["Based on this commit in the `httpbin` repo, it looks like the werkzeug version is constrained, but the dev dependencies do not constrain it to <2.3. Werkzeug removed the `parse_authorization_headers` func in v3.x.\n\n[URL]","This is a duplicate of other closed issues. Httpbin needs to be released"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-11-28T15:42:44Z","closed_at":"2023-11-29T14:17:43Z","updated_at":"2024-11-29T00:05:40Z","days_to_close":0.94,"created_year_month":"2023-11","labels":[],"issue_type":"bug","comments_reported":2,"n_comments_collected":2,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":22.58,"reactions_total":0,"author_id":"user_0271","author_association":"NONE","comment_author_ids":["user_0271","user_0028"],"comment_author_roles":["NONE","CONTRIBUTOR"],"comment_by_issue_author":[true,false],"has_code_block":true,"has_traceback":false,"title_words":4,"body_words":73,"locked":true}
{"number":6591,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6591","title":"Failed to establish a new connection: [Errno -2] Name or service not known","body_clean":"I have this code that is trying to divide a wordlist in 20 segments in order to create 20 threads that work with each segment when calling to fuzzer_directiorios and fuzzer_subdomains:\n\n```\nimport requests\nfrom requests.adapters import HTTPAdapter\nfrom requests.packages.urllib3.util.retry import Retry\nfrom concurrent.futures import ThreadPoolExecutor\nfrom colorama import Fore, Style\nimport socket\n\n#Función para hacer fuzzer de subdominios o fuzzer de directorios\ndef Fuzzer():\n menu = \"\"\"\n ===================================<<< MENU DE FUZZER >>>======================================\n [1] Fuzzer de Directorios\n [2] Fuzzer de Subdominios\n [3] Volver al menu\n \"\"\"\n choosen = False\n #Bucle hasta que choosen sea True para permitir al usuario escoger una opcion de escaneo\n while not choosen:\n\n print(Style.BRIGHT+Fore.LIGHTYELLOW_EX+menu)\n #Muestra mensaje de seleccion y entrada de un valor correspondiente a cada opcion\n option = input(Style.BRIGHT+Fore.LIGHTWHITE_EX+\"Seleccione una opcion de fuzzer: \")\n #Opcion 1: Fuzzer de Directorios\n if option == '1':\n choosen = True\n url = '[URL] \n filename = '\/home\/test\/Descargas\/directory-list-2.3-medium.txt'\n with open(filename, 'r') as file:\n wordlist = file.readlines()\n \n segment_size = len(wordlist) \/\/ 20\n segments = [wordlist[i:i + segment_size] for i in range(0, len(wordlist), segment_size)]\n \n try:\n with ThreadPoolExecutor(max_workers=20) as executor:\n executor.map(fuzzer_directorios, [url] * 20, segments, timeout=30)\n except KeyboardInterrupt:\n print(Style.BRIGHT+Fore.RED+\"\\n[!] Script terminado (Ctrl + C)\")\n finally:\n file.close()\n \n #Opcion 2: Fuzzer de Subdominios\n elif option == '2':\n choosen = True\n domain = 'google.es'\n resolved_address = socket.gethostbyname(domain) \n filename = '\/home\/test\/Descargas\/subdomains-10000.txt'\n with open(filename, 'r') as file:\n wordlist = file.readlines()\n \n segment_size = len(wordlist) \/\/ 20\n segments = [wordlist[i:i + segment_size] for i in range(0, len(wordlist), segment_size)]\n \n try:\n with ThreadPoolExecutor(max_workers=20) as executor:\n executor.map(fuzzer_subdomains, [domain] * 20, segments, timeout=30)\n except KeyboardInterrupt:\n print(Style.BRIGHT+Fore.RED+\"\\n[!] Script terminado (Ctrl + C)\")\n finally:\n file.close()\n \n #Opcion 3: Volver al menu\n elif option == '3':\n return 0\n else:\n print(Style.BRIGHT+Fore.RED+\"[!] Opcion inválida, intentalo de nuevo!\")\n sleep(1) \n\n# Función para fuzzear directorios\ndef fuzzer_directorios(url, wordlist):\n for line in wordlist:\n url_compl = url + line # Crea la URL completa\n # Comprueba si la URL completa existe\n try:\n session = requests.Session()\n retry = Retry(total=2, backoff_factor=0.1)\n adapter = HTTPAdapter(max_retries=retry)\n session.mount('[URL] adapter)\n session.mount('[URL] adapter) \n response = session.get(url_compl, timeout=10)\n if response.status_code == 200:\n print(Style.BRIGHT + Fore.GREEN + f\"Directorio encontrado: {url_compl}\") \n except requests.RequestException as e:\n print(Style.BRIGHT + Fore.RED + f\"[!] Se produjo un error durante alguna solicitud: {e}\")\n except KeyboardInterrupt:\n print(Style.BRIGHT+Fore.RED+\"\\n[!] Script terminado (Ctrl + C)\")\n\n# Función para fuzzear subdominios \ndef fuzzer_subdomains(domain, wordlist):\n for entry in wordlist:\n subdomain = entry.strip() # Elimina caracteres de espacio en blanco\n full_http_url = f\"[URL] # URL completa con HTTP\n full_https_url = f\"[URL] # URL completa con HTTPS\n headers = {'Host': f'{subdomain}.{domain}'} # Configura el Host de la cabecera HTTP\n # Realiza peticiones HTTP y HTTPS con el subdominio en la cabecera 'Host'\n try:\n session = requests.Session()\n retry = Retry(total=2, backoff_factor=0.1)\n adapter = HTTPAdapter(max_retries=retry)\n session.mount('[URL] adapter)\n session.mount('[URL] adapter) \n response_http = session.get(full_http_url, headers=headers, allow_redirects=False, timeout=10)\n response_https = session.get(full_https_url, headers=headers, allow_redirects=False,timeout=10)\n # Comprueba si el subdominio fue encontrado\n if response_http.status_code == 200 or response_https.status_code == 200:\n print(Style.BRIGHT + Fore.GREEN + f\"Subdominio encontrado: {subdomain}.{domain}\")\n except requests.RequestException as e:\n print(Style.BRIGHT + Fore.RED + f\"[!] Se produjo un error durante alguna solicitud: {e}\")\n except KeyboardInterrupt:\n print(Style.BRIGHT+Fore.RED+\"\\n[!] Script terminado (Ctrl + C)\")\n \n\ndef main():\n Fuzzer()\n\nif __name__ == \"__main__\":\n main()\n```\n\nMy problem is when I execute any of both fuzzers this is what I obtain\n tests failing","body_clean":"One of the first steps in contributing to the repository is running the tests locally. However, the tests are failing with the error stated below. Looking through the latest main build, outside of version 3.7, the tests are failing on build as well ([URL]\n\n## Expected Result\n\n \nRunning `python -m pytest tests` will gather and run the test suite, reporting passes and fails.\n\n## Actual Result\n\n \nPython fails with the following result\n```\nTraceback (most recent call last):\n File \"\", line 198, in _run_module_as_main\n File \"\", line 88, in _run_code\n File \"\/.local\/lib\/python3.11\/site-packages\/pytest\/__main__.py\", line 5, in \n raise SystemExit(pytest.console_main())\n ^^^^^^^^^^^^^^^^^^^^^\n File \"\/.local\/lib\/python3.11\/site-packages\/_pytest\/config\/__init__.py\", line 185, in console_main\n code = main()\n ^^^^^^\n File \"\/.local\/lib\/python3.11\/site-packages\/_pytest\/config\/__init__.py\", line 143, in main\n config = _prepareconfig(args, plugins)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\/.local\/lib\/python3.11\/site-packages\/_pytest\/config\/__init__.py\", line 318, in _prepareconfig\n config = pluginmanager.hook.pytest_cmdline_parse(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\/usr\/lib\/python3.11\/site-packages\/pluggy\/_hooks.py\", line 265, in __call__\n return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\/usr\/lib\/python3.11\/site-packages\/pluggy\/_manager.py\", line 80, in _hookexec\n return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\/usr\/lib\/python3.11\/site-packages\/pluggy\/_callers.py\", line 55, in _multicall\n gen.send(outcome)\n File \"\/.local\/lib\/python3.11\/site-packages\/_pytest\/helpconfig.py\", line 100, in pytest_cmdline_parse\n config: Config = outcome.get_result()\n ^^^^^^^^^^^^^^^^^^^^\n File \"\/usr\/lib\/python3.11\/site-packages\/pluggy\/_result.py\", line 60, in get_result\n raise ex[1].with_traceback(ex[2])\n File \"\/usr\/lib\/python3.11\/site-packages\/pluggy\/_callers.py\", line 39, in _multicall\n res = hook_impl.function(*args)\n ^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\/.local\/lib\/python3.11\/site-packages\/_pytest\/config\/__init__.py\", line 1003, in pytest_cmdline_parse\n self.parse(args)\n File \"\/.local\/lib\/python3.11\/site-packages\/_pytest\/config\/__init__.py\", line 1283, in parse\n self._preparse(args, addopts=addopts)\n File \"\/.local\/lib\/python3.11\/site-packages\/_pytest\/config\/__init__.py\", line 1172, in _preparse\n self.pluginmanager.load_setuptools_entrypoints(\"pytest11\")\n File \"\/usr\/lib\/python3.11\/site-packages\/pluggy\/_manager.py\", line 287, in load_setuptools_entrypoints\n plugin = ep.load()\n ^^^^^^^^^\n File \"\/usr\/lib64\/python3.11\/importlib\/metadata\/__init__.py\", line 202, in load\n module = import_module(match.group('module'))\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\/usr\/lib64\/python3.11\/importlib\/__init__.py\", line 126, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\", line 1204, in _gcd_import\n File \"\", line 1176, in _find_and_load\n File \"\", line 1147, in _find_and_load_unlocked\n File \"\", line 690, in _load_unlocked\n File \"\/.local\/lib\/python3.11\/site-packages\/_pytest\/assertion\/rewrite.py\", line 170, in exec_module\n exec(co, module.__dict__)\n File \"\/.local\/lib\/python3.11\/site-packages\/pytest_httpbin\/plugin.py\", line 2, in \n from httpbin import app as httpbin_app\n File \"\/.local\/lib\/python3.11\/site-packages\/httpbin\/__init__.py\", line 3, in \n from .core import *\n File \"\/.local\/lib\/python3.11\/site-packages\/httpbin\/core.py\", line 35, in \n from werkzeug.http import parse_authorization_header\nImportError: cannot import name 'parse_authorization_header' from 'werkzeug.http' (\/.local\/lib\/python3.11\/site-packages\/werkzeug\/http.py)\n\n```\n\n## Reproduction Steps\n\n```\ngit clone [EMAIL]:psf\/requests.git\ncd requests\npip install -r requirements-dev.txt\npython -m pytest tests\n```\n\n## System Information\n\n $ python -m requests.help\n\n```\n{\n \"chardet\": {\n \"version\": \"5.2.0\"\n },\n \"charset_normalizer\": {\n \"version\": \"3.1.0\"\n },\n \"cryptography\": {\n \"version\": \"37.0.2\"\n },\n \"idna\": {\n \"version\": \"3.4\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.11.6\"\n },\n \"platform\": {\n \"release\": \"6.5.12-200.fc38.x86_64\",\n \"system\": \"Linux\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"30000080\",\n \"version\": \"21.0.0\"\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"30000090\"\n },\n \"urllib3\": {\n \"version\": \"1.26.18\"\n },\n \"using_charset_normalizer\": false,\n \"using_pyopenssl\": true\n}\n\n```","body_prose":"One of the first steps in contributing to the repository is running the tests locally. However, the tests are failing with the error stated below. Looking through the latest main build, outside of version 3.7, the tests are failing on build as well ([URL]\n\n## Expected Result\n\n \nRunning `python -m pytest tests` will gather and run the test suite, reporting passes and fails.\n\n## Actual Result\n\n \nPython fails with the following result\n [CODE] \n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"Local (and build) tests failing. One of the first steps in contributing to the repository is running the tests locally. However, the tests are failing with the error stated below. Looking through the latest main build, outside of version 3.7, the tests are failing on build as well ([URL]\n\n## Expected Result\n\n \nRunning `python -m pytest tests` will gather and run the test suite, reporting passes and fails.\n\n## Actual Result\n\n \nPython fails with the following result\n [CODE] \n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["In the future, please search **closed and** open issues before creating new ones that are duplicates.","@[USER] i did search and the most recent reference I found was older than a week when the build was still failing. Can you point me to the issue number in which it was closed please?"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-11-30T15:15:39Z","closed_at":"2023-11-30T16:24:43Z","updated_at":"2024-11-30T00:04:18Z","days_to_close":0.05,"created_year_month":"2023-11","labels":[],"issue_type":"bug","comments_reported":2,"n_comments_collected":2,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":1.15,"reactions_total":0,"author_id":"user_0270","author_association":"NONE","comment_author_ids":["user_0028","user_0270"],"comment_author_roles":["CONTRIBUTOR","NONE"],"comment_by_issue_author":[false,true],"has_code_block":true,"has_traceback":true,"title_words":5,"body_words":85,"locked":true}
{"number":6595,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6595","title":"Is it possible to send async generator as `data` argument of request method?","body_clean":"I'm using `requests` module in Python and I want to send data in request streaming way. so I applied chunked-encoded request according to [this document]([URL] \n\nHowever, the data to send is provided with another async method. Honestly speaking, I also use Sanic framework, and I read the stream data from `await sanic.request.stream.read()` and I want to relay the streaming data to `request` method of `requests` module.\n\n```\nasync def generate_from_sanic_request(request):\n while True:\n chunk = await request.stream.read()\n if chunk is None:\n break\n yield chunk\n\n...\nrequests.request(\n method=\"POST\",\n url=\"my-own-url\",\n data=generate_from_sanic_request, # here is the point of this question.\n)\n...\n```\nThe document says that I can use the non-async generator function as the `data` argument. However, when I use an async generator there, `requests.request` cannot handle the generator.\n\nI want to do this in a memory-efficient way, so I want to bypass the received streaming request body to requests.request method in one-by-one way.\n\nCan I get any help to solve this problem?\n\nThanks in advance.","body_prose":"I'm using `requests` module in Python and I want to send data in request streaming way. so I applied chunked-encoded request according to [this document]([URL] \n\nHowever, the data to send is provided with another async method. Honestly speaking, I also use Sanic framework, and I read the stream data from `await sanic.request.stream.read()` and I want to relay the streaming data to `request` method of `requests` module.\n\n [CODE] \nThe document says that I can use the non-async generator function as the `data` argument. However, when I use an async generator there, `requests.request` cannot handle the generator.\n\nI want to do this in a memory-efficient way, so I want to bypass the received streaming request body to requests.request method in one-by-one way.\n\nCan I get any help to solve this problem?\n\nThanks in advance.","text":"Is it possible to send async generator as `data` argument of request method?. I'm using `requests` module in Python and I want to send data in request streaming way. so I applied chunked-encoded request according to [this document]([URL] \n\nHowever, the data to send is provided with another async method. Honestly speaking, I also use Sanic framework, and I read the stream data from `await sanic.request.stream.read()` and I want to relay the streaming data to `request` method of `requests` module.\n\n [CODE] \nThe document says that I can use the non-async generator function as the `data` argument. However, when I use an async generator there, `requests.request` cannot handle the generator.\n\nI want to do this in a memory-efficient way, so I want to bypass the received streaming request body to requests.request method in one-by-one way.\n\nCan I get any help to solve this problem?\n\nThanks in advance.","comments":["It is not possible to use an async generator with requests. For help with your code, please use [StackOverflow]([URL]"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-12-01T08:39:11Z","closed_at":"2023-12-01T14:06:43Z","updated_at":"2024-12-02T00:05:56Z","days_to_close":0.23,"created_year_month":"2023-12","labels":["Question\/Not a bug","actions\/autoclose-qa"],"issue_type":"question","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":5.46,"reactions_total":0,"author_id":"user_0459","author_association":"NONE","comment_author_ids":["user_0028"],"comment_author_roles":["CONTRIBUTOR"],"comment_by_issue_author":[false],"has_code_block":true,"has_traceback":false,"title_words":13,"body_words":132,"locked":true}
{"number":6598,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6598","title":"affected urllib3 and certifi packages (older version keeping in setup.py file)","body_clean":"Please upgrade the urllib3 & certifi(2023.7.22) libraries.\nuse urllib3 >=1.26.18\ncertifi >= 2023.7.22\n\n## Expected Result\n Detecting\n detecting as vulnerabilites\n[URL]\n\n## Actual Result\n\n \n\nUpgrade to a patched version of urllib3 (v1.26.18 or v2.0.7)\nDisable redirects for services that you aren't expecting to respond with redirects with redirects=False.\nDisable automatic redirects with redirects=False and handle 303 redirects manually by stripping the HTTP request body.\n## Reproduction Steps\n\n```python\nimport requests\n\n```\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{\n \"paste\": \"here\"\n}\n```","body_prose":"Please upgrade the urllib3 & certifi(2023.7.22) libraries.\nuse urllib3 >=1.26.18\ncertifi >= 2023.7.22\n\n## Expected Result\n Detecting\n detecting as vulnerabilites\n[URL]\n\n## Actual Result\n\n \n\nUpgrade to a patched version of urllib3 (v1.26.18 or v2.0.7)\nDisable redirects for services that you aren't expecting to respond with redirects with redirects=False.\nDisable automatic redirects with redirects=False and handle 303 redirects manually by stripping the HTTP request body.\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"affected urllib3 and certifi packages (older version keeping in setup.py file). Please upgrade the urllib3 & certifi(2023.7.22) libraries.\nuse urllib3 >=1.26.18\ncertifi >= 2023.7.22\n\n## Expected Result\n Detecting\n detecting as vulnerabilites\n[URL]\n\n## Actual Result\n\n \n\nUpgrade to a patched version of urllib3 (v1.26.18 or v2.0.7)\nDisable redirects for services that you aren't expecting to respond with redirects with redirects=False.\nDisable automatic redirects with redirects=False and handle 303 redirects manually by stripping the HTTP request body.\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["Both of those versions are compatible with the current version of requests. There's nothing to do here"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-12-08T11:09:48Z","closed_at":"2023-12-08T11:13:11Z","updated_at":"2024-12-08T00:05:04Z","days_to_close":0.0,"created_year_month":"2023-12","labels":[],"issue_type":"other","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":0.05,"reactions_total":0,"author_id":"user_0458","author_association":"NONE","comment_author_ids":["user_0028"],"comment_author_roles":["CONTRIBUTOR"],"comment_by_issue_author":[false],"has_code_block":true,"has_traceback":false,"title_words":11,"body_words":76,"locked":true}
{"number":6601,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6601","title":"Since migration of urllib3 to 2.x data-strings with umlauts in a post request are truncated","body_clean":"Before requests 2.30 it was possible to just pass a Python-string with umlauts (äöü...) to a `requests.post` call. Since urllib3 2.x this causes the body of the request to be truncated. It seems that the Content-Length is calculated based on the length of the string and the string itself is handed over to the call as a multibyte representation causing the string to be truncated in the request because with multibyte characters there are more bytes than characters.\n\n## Expected Result\n\nAll characters of the input string should have been sent to the target.\n\n## Actual Result\n\nInput string is truncated. See output of code below:\n\n```\ndata:application\/octet-stream;base64,RGFzIHNpbmQgUG9zdC1EYXRlbiBtaXQgVW1sYXV0ZW46IMOkww==\ndata:application\/octet-stream;base64,RGFzIHNpbmQgUG9zdC1EYXRlbiBtaXQgVW1sYXV0ZW46IOT89g==\nDas sind Post-Daten mit Umlauten: äüö\n```\n\n## Reproduction Steps\n\n```python\nimport requests\nimport json\n\ndata_as_string = \"Das sind Post-Daten mit Umlauten: äüö\"\n\ndata_array = [\n data_as_string,\n bytes(data_as_string,'iso-8859-1'),\n bytes(data_as_string,'utf-8')\n]\n\npost_url = \"[URL]\n\nheaders = {\n \"Content-Type\": \"text\/plain\",\n \"Host\": \"httpbin.org\",\n}\n\ndef main():\n for d in data_array:\n response = requests.post(\n url=post_url,\n headers=headers,\n data=d\n )\n r = json.loads(response.content)\n print(r['data'])\n\nif __name__ == '__main__':\n main()\n```\n\nThe behaviour was also verified using Portswigger Burp Suite:\n\nFirst Request:\n\n```\n50 4F 53 54 20 2F 70 6F 73 74 20 48 54 54 50 2F 32 0D 0A 48 6F 73 74 3A 20 68 74 74 70 62 69 6E 2E 6F 72 67 0D 0A 55 73 65 72 2D 41 67 65 6E 74 3A 20 70 79 74 68 6F 6E 2D 72 65 71 75 65 73 74 73 2F 32 2E 33 31 2E 30 0D 0A 41 63 63 65 70 74 2D 45 6E 63 6F 64 69 6E 67 3A 20 67 7A 69 70 2C 20 64 65 66 6C 61 74 65 2C 20 62 72 0D 0A 41 63 63 65 70 74 3A 20 2A 2F 2A 0D 0A 43 6F 6E 6E 65 63 74 69 6F 6E 3A 20 63 6C 6F 73 65 0D 0A 43 6F 6E 74 65 6E 74 2D 54 79 70 65 3A 20 74 65 78 74 2F 70 6C 61 69 6E 0D 0A 43 6F 6E 74 65 6E 74 2D 4C 65 6E 67 74 68 3A 20 33 37 0D 0A 0D 0A 44 61 73 20 73 69 6E 64 20 50 6F 73 74 2D 44 61 74 65 6E 20 6D 69 74 20 55 6D 6C 61 75 74 65 6E 3A 20 C3 A4 C3\n```\n\n```\nPOST \/post HTTP\/2\nHost: httpbin.org\nUser-Agent: python-requests\/2.31.0\nAccept-Encoding: gzip, deflate, br\nAccept: *\/*\nConnection: close\nContent-Type: text\/plain\nContent-Length: 37\n\nDas sind Post-Daten mit Umlauten: äÃ\n```\n\nSecond Request:\n\n```\n50 4F 53 54 20 2F 70 6F 73 74 20 48 54 54 50 2F 32 0D 0A 48 6F 73 74 3A 20 68 74 74 70 62 69 6E 2E 6F 72 67 0D 0A 55 73 65 72 2D 41 67 65 6E 74 3A 20 70 79 74 68 6F 6E 2D 72 65 71 75 65 73 74 73 2F 32 2E 33 31 2E 30 0D 0A 41 63 63 65 70 74 2D 45 6E 63 6F 64 69 6E 67 3A 20 67 7A 69 70 2C 20 64 65 66 6C 61 74 65 2C 20 62 72 0D 0A 41 63 63 65 70 74 3A 20 2A 2F 2A 0D 0A 43 6F 6E 6E 65 63 74 69 6F 6E 3A 20 6B 65 65 70 2D 61 6C 69 76 65 0D 0A 43 6F 6E 74 65 6E 74 2D 54 79 70 65 3A 20 74 65 78 74 2F 70 6C 61 69 6E 0D 0A 43 6F 6E 74 65 6E 74 2D 4C 65 6E 67 74 68 3A 20 33 37 0D 0A 0D 0A 44 61 73 20 73 69 6E 64 20 50 6F 73 74 2D 44 61 74 65 6E 20 6D 69 74 20 55 6D 6C 61 75 74 65 6E 3A 20 E4 FC F6\n```\n\n```\nPOST \/post HTTP\/2\nHost: httpbin.org\nUser-Agent: python-requests\/2.31.0\nAccept-Encoding: gzip, deflate, br\nAccept: *\/*\nConnection: keep-alive\nContent-Type: text\/plain\nContent-Length: 37\n\nDas sind Post-Daten mit Umlauten: äüö\n```\n\nThird Request:\n\n```\n50 4F 53 54 20 2F 70 6F 73 74 20 48 54 54 50 2F 32 0D 0A 48 6F 73 74 3A 20 68 74 74 70 62 69 6E 2E 6F 72 67 0D 0A 55 73 65 72 2D 41 67 65 6E 74 3A 20 70 79 74 68 6F 6E 2D 72 65 71 75 65 73 74 73 2F 32 2E 33 31 2E 30 0D 0A 41 63 63 65 70 74 2D 45 6E 63 6F 64 69 6E 67 3A 20 67 7A 69 70 2C 20 64 65 66 6C 61 74 65 2C 20 62 72 0D 0A 41 63 63 65 70 74 3A 20 2A 2F 2A 0D 0A 43 6F 6E 6E 65 63 74 69 6F 6E 3A 20 6B 65 65 70 2D 61 6C 69 76 65 0D 0A 43 6F 6E 74 65 6E 74 2D 54 79 70 65 3A 20 74 65 78 74 2F 70 6C 61 69 6E 0D 0A 43 6F 6E 74 65 6E 74 2D 4C 65 6E 67 74 68 3A 20 34 30 0D 0A 0D 0A 44 61 73 20 73 69 6E 64 20 50 6F 73 74 2D 44 61 74 65 6E 20 6D 69 74 20 55 6D 6C 61 75 74 65 6E 3A 20 C3 A4 C3 BC C3 B6\n```\n\n```\nPOST \/post HTTP\/2\nHost: httpbin.org\nUser-Agent: python-requests\/2.31.0\nAccept-Encoding: gzip, deflate, br\nAccept: *\/*\nConnection: keep-alive\nContent-Type: text\/plain\nContent-Length: 40\n\nDas sind Post-Daten mit Umlauten: äüö\n```\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{ \n \"chardet\": { \n \"version\": null \n }, \n \"charset_normalizer\": {\n \"version\": \"3.3.2\" \n }, \n \"cryptography\": { \n \"version\": \"\" \n }, \n \"idna\": { \n \"version\": \"3.6\" \n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.12.0\"\n },\n \"platform\": {\n \"release\": \"10\",\n \"system\": \"Windows\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"300000b0\"\n },\n \"urllib3\": {\n \"version\": \"2.1.0\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}\n```","body_prose":"Before requests 2.30 it was possible to just pass a Python-string with umlauts (äöü...) to a `requests.post` call. Since urllib3 2.x this causes the body of the request to be truncated. It seems that the Content-Length is calculated based on the length of the string and the string itself is handed over to the call as a multibyte representation causing the string to be truncated in the request because with multibyte characters there are more bytes than characters.\n\n## Expected Result\n\nAll characters of the input string should have been sent to the target.\n\n## Actual Result\n\nInput string is truncated. See output of code below:\n\n [CODE] \n\n## Reproduction Steps\n\n [CODE] \n\nThe behaviour was also verified using Portswigger Burp Suite:\n\nFirst Request:\n\n [CODE] \n\n [CODE] \n\nSecond Request:\n\n [CODE] \n\n [CODE] \n\nThird Request:\n\n [CODE] \n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"Since migration of urllib3 to 2.x data-strings with umlauts in a post request are truncated. Before requests 2.30 it was possible to just pass a Python-string with umlauts (äöü...) to a `requests.post` call. Since urllib3 2.x this causes the body of the request to be truncated. It seems that the Content-Length is calculated based on the length of the string and the string itself is handed over to the call as a multibyte representation causing the string to be truncated in the request because with multibyte characters there are more bytes than characters.\n\n## Expected Result\n\nAll characters of the input string should have been sent to the target.\n\n## Actual Result\n\nInput string is truncated. See output of code below:\n\n [CODE] \n\n## Reproduction Steps\n\n [CODE] \n\nThe behaviour was also verified using Portswigger Burp Suite:\n\nFirst Request:\n\n [CODE] \n\n [CODE] \n\nSecond Request:\n\n [CODE] \n\n [CODE] \n\nThird Request:\n\n [CODE] \n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["Just saw [URL]\nSeems to be the same issue."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-12-13T14:09:36Z","closed_at":"2023-12-13T23:39:10Z","updated_at":"2024-12-13T00:06:48Z","days_to_close":0.4,"created_year_month":"2023-12","labels":[],"issue_type":"feature_request","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":null,"reactions_total":0,"author_id":"user_0269","author_association":"NONE","comment_author_ids":["user_0269"],"comment_author_roles":["NONE"],"comment_by_issue_author":[true],"has_code_block":true,"has_traceback":false,"title_words":15,"body_words":140,"locked":true}
{"number":6602,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6602","title":"the first response history url is incorrect","body_clean":"The first url returned from response.url is different than the url passed to requests.get\n## Expected Result\n\n \nI expected the first history url to be that same as passed into requests.get\n\n```\nRedirect #1\nURL: [URL]\n```\n\n## Actual Result\n\nThe first redirected url is always the same as the the first response.headers.get('Location')\n```python resp.py \nrequests.__version__ 2.31.0\ninitial url: [URL]\n\nRedirect #1\nURL: [URL]\nStatus Code: 301\nRedirect: [URL]\n\nRedirect #2\nURL: [URL]\nStatus Code: 302\nRedirect: [URL]\n\nURL: [URL]\nStatus Code: 200\nRedirect: None\n```\n \n\n## Reproduction Steps\n\n```python\nimport requests\n\nurl = \"[URL]\nheaders = {\n \"User-Agent\": \"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/58.0.3029.110 Safari\/537.36\"\n}\nresponse = requests.get(url, headers=headers, allow_redirects=True)\nprint(f\"requests.__version__ {requests.__version__}\")\nprint(f\"initial url: {url}\\n\")\n\nfor index, resp in enumerate(response.history, start=1):\n print(f\"Redirect #{index}\")\n print(f\"URL: {resp.url}\")\n print(f\"Status Code: {resp.status_code}\")\n print(f\"Redirect: {resp.headers.get('Location')}\\n\")\n\nprint(f\"URL: {response.url}\")\nprint(f\"Status Code: {response.status_code}\")\nprint(f\"Redirect: {response.headers.get('Location')}\")\n\n```\n\n## System Information\n\n {\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"3.3.2\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.6\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.10.12\"\n },\n \"platform\": {\n \"release\": \"22.6.0\",\n \"system\": \"Darwin\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"1010115f\"\n },\n \"urllib3\": {\n \"version\": \"2.0.7\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}","body_prose":"The first url returned from response.url is different than the url passed to requests.get\n## Expected Result\n\n \nI expected the first history url to be that same as passed into requests.get\n\n [CODE] \n\n## Actual Result\n\nThe first redirected url is always the same as the the first response.headers.get('Location')\n [CODE] \n \n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n {\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"3.3.2\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.6\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.10.12\"\n },\n \"platform\": {\n \"release\": \"22.6.0\",\n \"system\": \"Darwin\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"1010115f\"\n },\n \"urllib3\": {\n \"version\": \"2.0.7\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}","text":"the first response history url is incorrect. The first url returned from response.url is different than the url passed to requests.get\n## Expected Result\n\n \nI expected the first history url to be that same as passed into requests.get\n\n [CODE] \n\n## Actual Result\n\nThe first redirected url is always the same as the the first response.headers.get('Location')\n [CODE] \n \n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n {\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"3.3.2\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.6\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.10.12\"\n },\n \"platform\": {\n \"release\": \"22.6.0\",\n \"system\": \"Darwin\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"1010115f\"\n },\n \"urllib3\": {\n \"version\": \"2.0.7\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}","comments":["Hi @[USER],\n\nI'm assuming you're referring to the trailing `\/` in `[URL] That's a standard semantic of url normalization, and is identical to what you provided. This should be treated the same by a properly functioning server.\n\n> In general, a URI that uses the generic syntax for authority with an\n empty path should be normalized to a path of \"\/\".\n\n\\- [RFC 3986 6.2.3]([URL]\n\nYou may try setting the URL again with the [PreparedRequest workflow]([URL] but my hunch without having looked is this is happening in urllib3. If that's the case, this won't be adjustable."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-12-15T01:50:08Z","closed_at":"2023-12-20T06:32:20Z","updated_at":"2024-12-22T00:04:53Z","days_to_close":5.2,"created_year_month":"2023-12","labels":[],"issue_type":"bug","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":true,"hours_to_first_response":124.7,"reactions_total":0,"author_id":"user_0457","author_association":"NONE","comment_author_ids":["user_0007"],"comment_author_roles":["MEMBER"],"comment_by_issue_author":[false],"has_code_block":true,"has_traceback":false,"title_words":7,"body_words":118,"locked":true}
{"number":6604,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6604","title":"Links at docs site return 404","body_clean":"At [URL] all links under \"Usefull links\" lead to 404 page\n\n## Expected Result\n\nOpen corresponding docs page\n\n## Actual Result\n\n404 page\n\n## Reproduction Steps\n\n- Open [URL]\n- Click on \"[Quickstart]([URL]\n\n## System Information\nNot applicable","body_prose":"At [URL] all links under \"Usefull links\" lead to 404 page\n\n## Expected Result\n\nOpen corresponding docs page\n\n## Actual Result\n\n404 page\n\n## Reproduction Steps\n\n- Open [URL]\n- Click on \"[Quickstart]([URL]\n\n## System Information\nNot applicable","text":"Links at docs site return 404. At [URL] all links under \"Usefull links\" lead to 404 page\n\n## Expected Result\n\nOpen corresponding docs page\n\n## Actual Result\n\n404 page\n\n## Reproduction Steps\n\n- Open [URL]\n- Click on \"[Quickstart]([URL]\n\n## System Information\nNot applicable","comments":["Looks like `.html` at the end of link is what's missing","Working on it.","Resolved in #6605."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-12-17T06:33:58Z","closed_at":"2023-12-20T06:21:53Z","updated_at":"2024-12-22T00:04:55Z","days_to_close":2.99,"created_year_month":"2023-12","labels":[],"issue_type":"documentation","comments_reported":3,"n_comments_collected":3,"comments_complete":true,"maintainer_replied":true,"hours_to_first_response":14.96,"reactions_total":2,"author_id":"user_0267","author_association":"NONE","comment_author_ids":["user_0267","user_0268","user_0007"],"comment_author_roles":["NONE","CONTRIBUTOR","MEMBER"],"comment_by_issue_author":[true,false,false],"has_code_block":false,"has_traceback":false,"title_words":6,"body_words":38,"locked":true}
{"number":6610,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6610","title":"I don't think the name of this function is appropriate, because the return value of this function is a ConnectionPool object, and the first sentence of the comment is also wrong, which makes it a huge difficulty for me to read!!","body_clean":"def get_connection(self, url, proxies=None):\n \"\"\"Returns a urllib3 connection for the given URL. This should not be\n called from user code, and is only exposed for use when subclassing the\n :class:`HTTPAdapter `.\n\n :param url: The URL to connect to.\n :param proxies: (optional) A Requests-style dictionary of proxies used on this request.\n :rtype: urllib3.ConnectionPool","body_prose":"def get_connection(self, url, proxies=None):\n \"\"\"Returns a urllib3 connection for the given URL. This should not be\n called from user code, and is only exposed for use when subclassing the\n :class:`HTTPAdapter `.\n\n :param url: The URL to connect to.\n :param proxies: (optional) A Requests-style dictionary of proxies used on this request.\n :rtype: urllib3.ConnectionPool","text":"I don't think the name of this function is appropriate, because the return value of this function is a ConnectionPool object, and the first sentence of the comment is also wrong, which makes it a huge difficulty for me to read!!. def get_connection(self, url, proxies=None):\n \"\"\"Returns a urllib3 connection for the given URL. This should not be\n called from user code, and is only exposed for use when subclassing the\n :class:`HTTPAdapter `.\n\n :param url: The URL to connect to.\n :param proxies: (optional) A Requests-style dictionary of proxies used on this request.\n :rtype: urllib3.ConnectionPool","comments":["adapters.HTTPAdapter.get_connection","You're right. As documented we are returning a connection pool which behaves almost identically to a connection. Alas, that method and that contract has existed for over a decade at this point, so we will not be changing it"],"state":"closed","state_reason":"not_planned","is_closed":true,"created_at":"2023-12-21T12:11:29Z","closed_at":"2023-12-21T12:53:12Z","updated_at":"2024-12-22T00:04:50Z","days_to_close":0.03,"created_year_month":"2023-12","labels":[],"issue_type":"bug","comments_reported":2,"n_comments_collected":2,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":0.69,"reactions_total":2,"author_id":"user_0266","author_association":"NONE","comment_author_ids":["user_0266","user_0028"],"comment_author_roles":["NONE","CONTRIBUTOR"],"comment_by_issue_author":[true,false],"has_code_block":false,"has_traceback":false,"title_words":41,"body_words":52,"locked":true}
{"number":6611,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6611","title":"Unexpected `UnicodeError` on some URL","body_clean":"Seems that `requests` haven't handle well some url which `curl` handle quite well.\n\n## Expected Result\n\nShould work.\n\n## Actual Result\n\nCrashed as `UnicodeError: label empty or too long`\n\n## Reproduction Steps\n\n```python\nimport requests\n\nrequests.get(\"[URL]\n```\n\n## System Information\n\n```json\n{\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"3.3.2\"\n },\n \"cryptography\": {\n \"version\": \"41.0.5\"\n },\n \"idna\": {\n \"version\": \"3.4\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.10.13\"\n },\n \"platform\": {\n \"release\": \"21.6.0\",\n \"system\": \"Darwin\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"30100040\",\n \"version\": \"23.2.0\"\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"30200000\"\n },\n \"urllib3\": {\n \"version\": \"1.26.18\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": true\n}\n```","body_prose":"Seems that `requests` haven't handle well some url which `curl` handle quite well.\n\n## Expected Result\n\nShould work.\n\n## Actual Result\n\nCrashed as `UnicodeError: label empty or too long`\n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n [CODE]","text":"Unexpected `UnicodeError` on some URL. Seems that `requests` haven't handle well some url which `curl` handle quite well.\n\n## Expected Result\n\nShould work.\n\n## Actual Result\n\nCrashed as `UnicodeError: label empty or too long`\n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n [CODE]","comments":["I want to work on this, it would be great if anyone assign this to me!","Duplicate of #6026 #4187 and many others"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-12-22T19:42:09Z","closed_at":"2024-01-02T12:42:58Z","updated_at":"2025-01-03T00:04:15Z","days_to_close":10.71,"created_year_month":"2023-12","labels":[],"issue_type":"bug","comments_reported":2,"n_comments_collected":2,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":111.52,"reactions_total":0,"author_id":"user_0456","author_association":"NONE","comment_author_ids":["user_0265","user_0028"],"comment_author_roles":["NONE","CONTRIBUTOR"],"comment_by_issue_author":[false,false],"has_code_block":true,"has_traceback":false,"title_words":5,"body_words":37,"locked":true}
{"number":6614,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6614","title":"python requests.get() stuck","body_clean":"url=links[x]\n \n try:\n response=requests.get(url,headers=HEADERLISTS,proxies={\"http\":proxy_lists[prox_index]},timeout=(10,10))\n except Exception as e:\n print(\"Error : \",e)\n sys.stderr = open('error.log', 'a+', encoding='utf-8')\n traceback.print_exc()\n sys.stderr.close()\n prox_index+=1\n time.sleep(1)\n continue\n if response.status_code==404:\n print(\"status code 404\")\n prox_index+=1\n CURRENT_NUMBER+=1\n x+=1\n time.sleep(1)\n continue\n if response.status_code!=200:\n print(\"status code: \",response.status_code)\n prox_index+=1\n time.sleep(1)\n continue\n time.sleep(1)\n prox_index+=1\n CURRENT_NUMBER+=1\n x+=1\n \n\n**This is my code. Script running After sometime response is not comming and get stuck. Next iteration is not going. Please give me solution.**","body_prose":"url=links[x]\n \n try:\n response=requests.get(url,headers=HEADERLISTS,proxies={\"http\":proxy_lists[prox_index]},timeout=(10,10))\n except Exception as e:\n print(\"Error : \",e)\n sys.stderr = open('error.log', 'a+', encoding='utf-8')\n traceback.print_exc()\n sys.stderr.close()\n prox_index+=1\n time.sleep(1)\n continue\n if response.status_code==404:\n print(\"status code 404\")\n prox_index+=1\n CURRENT_NUMBER+=1\n x+=1\n time.sleep(1)\n continue\n if response.status_code!=200:\n print(\"status code: \",response.status_code)\n prox_index+=1\n time.sleep(1)\n continue\n time.sleep(1)\n prox_index+=1\n CURRENT_NUMBER+=1\n x+=1\n \n\n**This is my code. Script running After sometime response is not comming and get stuck. Next iteration is not going. Please give me solution.**","text":"python requests.get() stuck. url=links[x]\n \n try:\n response=requests.get(url,headers=HEADERLISTS,proxies={\"http\":proxy_lists[prox_index]},timeout=(10,10))\n except Exception as e:\n print(\"Error : \",e)\n sys.stderr = open('error.log', 'a+', encoding='utf-8')\n traceback.print_exc()\n sys.stderr.close()\n prox_index+=1\n time.sleep(1)\n continue\n if response.status_code==404:\n print(\"status code 404\")\n prox_index+=1\n CURRENT_NUMBER+=1\n x+=1\n time.sleep(1)\n continue\n if response.status_code!=200:\n print(\"status code: \",response.status_code)\n prox_index+=1\n time.sleep(1)\n continue\n time.sleep(1)\n prox_index+=1\n CURRENT_NUMBER+=1\n x+=1\n \n\n**This is my code. Script running After sometime response is not comming and get stuck. Next iteration is not going. Please give me solution.**","comments":["This doesn't look like a bug with requests library but with your code. Please ask in StackOverflow and using the `python-requests` tag."],"state":"closed","state_reason":"not_planned","is_closed":true,"created_at":"2023-12-25T11:09:00Z","closed_at":"2023-12-25T15:05:14Z","updated_at":"2024-12-25T00:04:12Z","days_to_close":0.16,"created_year_month":"2023-12","labels":["Question\/Not a bug"],"issue_type":"question","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":0.87,"reactions_total":0,"author_id":"user_0380","author_association":"NONE","comment_author_ids":["user_0044"],"comment_author_roles":["NONE"],"comment_by_issue_author":[false],"has_code_block":false,"has_traceback":false,"title_words":3,"body_words":66,"locked":true}
{"number":6615,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6615","title":"How to use multiple redundant hosts","body_clean":"I would like to understand whether (and how) it is possible to configure requests to target multiple redundant hosts and to use one of them that is reachable.\n\nFollowing the guideline to post such help requests in SO, I asked that in [URL] and got a response there which so far I did not get to work. So I wanted to ask the maintainers directly.","body_prose":"I would like to understand whether (and how) it is possible to configure requests to target multiple redundant hosts and to use one of them that is reachable.\n\nFollowing the guideline to post such help requests in SO, I asked that in [URL] and got a response there which so far I did not get to work. So I wanted to ask the maintainers directly.","text":"How to use multiple redundant hosts. I would like to understand whether (and how) it is possible to configure requests to target multiple redundant hosts and to use one of them that is reachable.\n\nFollowing the guideline to post such help requests in SO, I asked that in [URL] and got a response there which so far I did not get to work. So I wanted to ask the maintainers directly.","comments":["@[USER] looking at your StackOverflow question you're saying you don't want to use things that are the standard for achieving this. You don't want to use a load balancer because you don't want a single address (which doesn't make a great deal of sense) but fine. Is there a reason you're not leveraging DNS on your internal network? That would allow you to specify `hmc-service` as a DNS name which resolves to `N` addresses. `urllib3` would then retry those until they find one that works. There's countless StackOverflow questions around using dnsmasq and other free software to do exactly this.\n\nIn short, none of this is what one would expect of a typical HTTP client library providing the level of interface we provide. And urllib3 isn't exactly the right place for this either. If you want something like this, your issue in the client library is probably the best place because whatever logic you think is \"right\" here probably isn't right for a large enough percentage of requests or urllib3 users.\n\n---\n\nPut another way, many things operate in a fashion you're describing - databases with redundant servers as one example. In those cases the client libraries for those things do not rely on the underlying TCP libraries to allow users to specify how to connect\/what redundant addresses are they either:\n\n* Specify it at the client level (e.g., tell the library you want it to behave a [certain way]([URL] and either tell it the redundant addresses or have the remote service tell you how to find them)\n* Specify it another way outside of the library's control (e.g., DNS; if you're on an IaaS that supports IP swapping, have a healthcheck that dynamically swaps the IP address of the thing you're trying to connect to over to one of the healthy redundant hosts; etc.).\n\n---\n\nFinally, the answer you received will not work likely because it looks like an AI hallucination to me and the person answering likely doesn't understand what is happening. SOCKS is a proxy protocol that is almost certainly completely unrelated to what you were asking so you don't need that at all. In fact, I'm 99% certain that's an LLM hallucination because the [SOCKS Proxy Manager]([URL] does not have any [`resolver` attribute whatsoever]([URL] and neither does the class it inherits from."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2023-12-30T13:24:51Z","closed_at":"2024-01-01T12:45:31Z","updated_at":"2025-01-03T00:04:16Z","days_to_close":1.97,"created_year_month":"2023-12","labels":[],"issue_type":"question","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":47.34,"reactions_total":0,"author_id":"user_0455","author_association":"NONE","comment_author_ids":["user_0028"],"comment_author_roles":["CONTRIBUTOR"],"comment_by_issue_author":[false],"has_code_block":false,"has_traceback":false,"title_words":6,"body_words":65,"locked":true}
{"number":6616,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6616","title":"sslv3 alert handshake failure","body_clean":"Trying to connect [URL] using requests module but it raises the ssl error when using requests==2.31.0 but not on when using requests==2.29.0 but have not tried it on v2.30\n\n## Expected Result\n\nThe web page html text content\n\n## Actual Result\n\nraise SSLError(e, request=request)\nrequests.exceptions.SSLError: HTTPSConnectionPool(host='www.irctc.co.in', port=443): Max retries exceeded with url: \/nget\/train-search (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1006)')))\n\n## Reproduction Steps\n\n```python\nimport requests\nr = requests.get(\"[URL]\nprint(r.text)\n```\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"2.0.12\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.6\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.11.7\"\n },\n \"platform\": {\n \"release\": \"10\",\n \"system\": \"Windows\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.28.0\"\n },\n \"system_ssl\": {\n \"version\": \"300000b0\"\n },\n \"urllib3\": {\n \"version\": \"1.26.18\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}\n```","body_prose":"Trying to connect [URL] using requests module but it raises the ssl error when using requests==2.31.0 but not on when using requests==2.29.0 but have not tried it on v2.30\n\n## Expected Result\n\nThe web page html text content\n\n## Actual Result\n\nraise SSLError(e, request=request)\nrequests.exceptions.SSLError: HTTPSConnectionPool(host='www.irctc.co.in', port=443): Max retries exceeded with url: \/nget\/train-search (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1006)')))\n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"sslv3 alert handshake failure. Trying to connect [URL] using requests module but it raises the ssl error when using requests==2.31.0 but not on when using requests==2.29.0 but have not tried it on v2.30\n\n## Expected Result\n\nThe web page html text content\n\n## Actual Result\n\nraise SSLError(e, request=request)\nrequests.exceptions.SSLError: HTTPSConnectionPool(host='www.irctc.co.in', port=443): Max retries exceeded with url: \/nget\/train-search (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1006)')))\n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow]([URL] for general usage questions instead and only report defects here.","This (and some similar recent issues reported here) are probably a result of the CVE fix in 2.31.0. I'm seeing the same thing with a system we connect to with Requests, after upgrading to 2.31.0, and the problem goes away on downgrade to 2.30.0, all else remaining the same. It's not yet clear to me exactly what's going wrong from reading either the error message or the release log for 2.31.0, so I'm not sure whether this is misconfig of the system we're trying to connect to (correctly tripping this new CVE fix, and erroring) and Requests is behaving as it should, or if this is a regression in Requests and our systems are fine. Commenting here so others who end up here have some kind of pointer to what's behind this issue, don't yet have enough info to file this as a bug (indeed, it may not be one).","Hi @[USER],\n\nNothing should have changed in Requests between those two versions _unless_ you were using a non-`https` scheme and somehow requiring `Proxy-Authorization` being sent beyond your proxy to the destination host. There shouldn't be any standard configuration doing this. You can find the full list of changes [here]([URL] but I wouldn't expect this to do anything to your TLS handshake.\n\nYou may want to note which version of urllib3 you're using in each deployment. Requests<=2.29.0 does not use urllib3 2.0 which made a change to stop using a fixed set of ciphers and instead relies on system configuration from OpenSSL.","Yep, it's almost certainly that @[USER] . Setting a custom SSL context for urllib ended up being the fix. I'm glad, because I was scratching my head, looking at that tiny diff between 2.30 and 2.31 and trying to figure out _how_ that could be the problem.\n\nHelpful link for anyone else who arrives in this thread: [URL]"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-01-01T23:02:23Z","closed_at":"2024-01-02T12:36:52Z","updated_at":"2024-02-29T02:38:51Z","days_to_close":0.57,"created_year_month":"2024-01","labels":[],"issue_type":"bug","comments_reported":4,"n_comments_collected":4,"comments_complete":true,"maintainer_replied":true,"hours_to_first_response":13.57,"reactions_total":1,"author_id":"user_0454","author_association":"NONE","comment_author_ids":["user_0028","user_0264","user_0007","user_0264"],"comment_author_roles":["CONTRIBUTOR","NONE","MEMBER","NONE"],"comment_by_issue_author":[false,false,false,false],"has_code_block":true,"has_traceback":false,"title_words":4,"body_words":75,"locked":true}
{"number":6622,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6622","title":"Refresh Test PyPi Package","body_clean":"The Python Package on [TestPyPI has not been updated since 14 March 2015 i.e. 2.5.4.1.]([URL] and therefore references the deprecated `python-requests.org`\n\n[URL] is my recent Twitter thread with @[USER]","body_prose":"The Python Package on [TestPyPI has not been updated since 14 March 2015 i.e. 2.5.4.1.]([URL] and therefore references the deprecated `python-requests.org`\n\n[URL] is my recent Twitter thread with @[USER]","text":"Refresh Test PyPi Package. The Python Package on [TestPyPI has not been updated since 14 March 2015 i.e. 2.5.4.1.]([URL] and therefore references the deprecated `python-requests.org`\n\n[URL] is my recent Twitter thread with @[USER]","comments":["No. TestPyPI generally should be evicting those after a period of time thus someone is uploading that. Further TestPyPI isn't intended to have any use besides verifying your upload works. Don't install things from there","@[USER] wrote:\n> No. TestPyPI generally should be evicting those after a period of time thus someone is uploading that. Further TestPyPI isn't intended to have any use besides verifying your upload works. Don't install things from there\n\n@[USER] stated during 2020 that \"[_currently there is no limit to how long releases might remain on TestPyPI_]([URL]\n\nSince the above is technically outside of the control of `requests` then I'll escalate this to [URL]"],"state":"closed","state_reason":"not_planned","is_closed":true,"created_at":"2024-01-17T01:28:03Z","closed_at":"2024-01-17T01:57:07Z","updated_at":"2025-01-17T00:04:17Z","days_to_close":0.02,"created_year_month":"2024-01","labels":[],"issue_type":"other","comments_reported":2,"n_comments_collected":2,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":0.48,"reactions_total":0,"author_id":"user_0263","author_association":"NONE","comment_author_ids":["user_0028","user_0263"],"comment_author_roles":["CONTRIBUTOR","NONE"],"comment_by_issue_author":[false,true],"has_code_block":false,"has_traceback":false,"title_words":4,"body_words":29,"locked":true}
{"number":6625,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6625","title":"How to get IP address of connected host after getting the response?","body_clean":"Hello,\n\nI'm trying to understand how I could access information about host that the request connected to. I have situation when behind a hostname, there is a multiple IP addresses that you can connect to, so for example `x.com` can route me to `1.2.3.4` or `2.3.4.5`. I need that information after receiving response from requests. I'm using python 3.10 if that matters.\n\nMy code is as follows:\n\n```\nretry_strategy = Retry(total=1,\nbackoff_factor=0.5,\nstatus_forcelist=[400, 408, 429, 500, 501, 502, 503, 504],\nraise_on_status=False)\n \nself.adapter = HTTPAdapter(max_retries=retry_strategy)\n\n# other, not important code\n\ns = Session()\ns.mount('[URL] self.adapter)\nresponse = s.get(url, headers=self.headers, stream=True, timeout=60)\n```\n\nWhere (if anywhere?) should I look for that kind of information? I found something about `response.raw` but the connection there is declared as None.","body_prose":"Hello,\n\nI'm trying to understand how I could access information about host that the request connected to. I have situation when behind a hostname, there is a multiple IP addresses that you can connect to, so for example `x.com` can route me to `1.2.3.4` or `2.3.4.5`. I need that information after receiving response from requests. I'm using python 3.10 if that matters.\n\nMy code is as follows:\n\n [CODE] \n\nWhere (if anywhere?) should I look for that kind of information? I found something about `response.raw` but the connection there is declared as None.","text":"How to get IP address of connected host after getting the response?. Hello,\n\nI'm trying to understand how I could access information about host that the request connected to. I have situation when behind a hostname, there is a multiple IP addresses that you can connect to, so for example `x.com` can route me to `1.2.3.4` or `2.3.4.5`. I need that information after receiving response from requests. I'm using python 3.10 if that matters.\n\nMy code is as follows:\n\n [CODE] \n\nWhere (if anywhere?) should I look for that kind of information? I found something about `response.raw` but the connection there is declared as None.","comments":["As described in the template, we won't be able to answer questions on this issue tracker. Please use [Stack Overflow]([URL]"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-01-23T15:10:15Z","closed_at":"2024-01-23T15:10:26Z","updated_at":"2024-01-23T15:10:28Z","days_to_close":0.0,"created_year_month":"2024-01","labels":["Question\/Not a bug","actions\/autoclose-qa"],"issue_type":"question","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":0.0,"reactions_total":0,"author_id":"user_0453","author_association":"NONE","comment_author_ids":["user_0023"],"comment_author_roles":["NONE"],"comment_by_issue_author":[false],"has_code_block":true,"has_traceback":false,"title_words":12,"body_words":92,"locked":true}
{"number":6627,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6627","title":"Kenneth Reitz, Take care of yourself.","body_clean":"I am also the author of a popular open-source library (MagicIndicator, 10K stars). Similarly, I have experienced manic depression (bipolar disorder), but I have overcome it and now lead a normal, positive life. I hope you recover soon too. Keep fighting!","body_prose":"I am also the author of a popular open-source library (MagicIndicator, 10K stars). Similarly, I have experienced manic depression (bipolar disorder), but I have overcome it and now lead a normal, positive life. I hope you recover soon too. Keep fighting!","text":"Kenneth Reitz, Take care of yourself.. I am also the author of a popular open-source library (MagicIndicator, 10K stars). Similarly, I have experienced manic depression (bipolar disorder), but I have overcome it and now lead a normal, positive life. I hope you recover soon too. Keep fighting!","comments":["Closing this issue as it's not an issue in Requests. Please consider avenues of messaging folks directly, opening GitHub issues pings thousands of unrelated people."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-01-31T02:10:27Z","closed_at":"2024-01-31T02:16:26Z","updated_at":"2024-01-31T02:40:14Z","days_to_close":0.0,"created_year_month":"2024-01","labels":[],"issue_type":"other","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":true,"hours_to_first_response":0.1,"reactions_total":0,"author_id":"user_0452","author_association":"NONE","comment_author_ids":["user_0141"],"comment_author_roles":["MEMBER"],"comment_by_issue_author":[false],"has_code_block":false,"has_traceback":false,"title_words":6,"body_words":41,"locked":true}
{"number":6628,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6628","title":"[BUG] JSONDecodeError can't be deserialized - invalid JSON raises a BrokenProcessPool and crashes the entire process pool","body_clean":"Hi all,\n\nI've stumbled upon a bug in the `requests` library, and have a proposal for a fix.\n\nIn short: I have a process pool running tasks in parallel, that are among other things doing queries to third-party APIs. One third-party returns an invalid JSON document as response in case of error.\n\nHowever, instead of just having a JSONDecodeError as the result of my job, the entire process pool crashes due to a BrokenProcessPool error with the following stack trace:\n\n```\nTraceback (most recent call last):\n File \"\/usr\/local\/lib\/python3.11\/concurrent\/futures\/process.py\", line 424, in wait_result_broken_or_wakeup\n result_item = result_reader.recv()\n ^^^^^^^^^^^^^^^^^^^^\n File \"\/usr\/local\/lib\/python3.11\/multiprocessing\/connection.py\", line 251, in recv\n return _ForkingPickler.loads(buf.getbuffer())\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\/usr\/local\/lib\/python3.11\/site-packages\/requests\/exceptions.py\", line 41, in __init__\n CompatJSONDecodeError.__init__(self, *args)\nTypeError: JSONDecodeError.__init__() missing 2 required positional arguments: 'doc' and 'pos'\n```\n\nSo I'm in a situation where receiving one invalid JSON as response is interrupting all my ongoing tasks because the entire process pool is crashing, and no more tasks can be submitted until the process pool recovered.\n\n## Origin of the bug + Fix\n\nAfter investigation, this is because the `requests.exception.JSONDecodeError` instances can't be deserialized once they've been serialized via `pickle`. So when the main process is trying to deserialize the error returned by the child process, the main process is crashing with to the error above.\n\nI think this bug has been around for a while, I've found old tickets from different projects mentioning issues that are looking similar: [URL]\n\nI've pinpointed the bug to the following class: [URL]\n\nBasically, due the MRO\/order of inheritance, the `__reduce__` method used will not be the one of `CompatJSONDecodeError`. Most of the args will therefore be ditched when pickling the instance and it can't be deserialised back because `CompatJSONDecodeError.__init__` does expect those args. MRO below:\n\n```\nIn [1]: from requests.exceptions import JSONDecodeError\n\nIn [2]: JSONDecodeError.__mro__\nOut[2]:\n(requests.exceptions.JSONDecodeError,\n requests.exceptions.InvalidJSONError,\n requests.exceptions.RequestException,\n OSError,\n simplejson.errors.JSONDecodeError,\n ValueError,\n Exception,\n BaseException,\n object)\n```\n\nI think the fix could be quite simple and should have very little side-effects: to specify a `JSONDecodeError.__reduce__` method that will call the one from the correct parent class (it will be regardless that it is json\/simplejson via the Compat class, their respective methods having different signatures).\n\nI've taken the initiative to write a fix + a test and will raise a pull request to that effect 🙏 \n\n-----\n\n## Expected Result\n\nI've written a test for this case: the error can easily be reproduced by simply trying to `pickle.dumps()` then `pickle.loads()` on a error:\n\n```python\njson_decode_error = requests.exceptions.JSONDecodeError(\n \"Extra data\",\n '{\"responseCode\":[\"706\"],\"data\":null}{\"responseCode\":[\"706\"],\"data\":null}',\n 36,\n)\ndeserialized_error = pickle.loads(pickle.dumps(json_decode_error))\nassert repr(json_decode_error) == repr(deserialized_error)\n```\n\nThis assertion should be true\n\n## Actual Result\n\nCurrently, instead of passing it'll raise the following error:\n\n```\n> CompatJSONDecodeError.__init__(self, *args)\nE TypeError: JSONDecodeError.__init__() missing 2 required positional arguments: 'doc' and 'pos'\n```\n\n## Reproduction Steps\n\nAs mentioned above, this bug is more impactful in a multi-process architecture as it'll break the entire process pool.\nFor something looking a bit more like a live-case, I've produced a little snippet with a really simple API returning an invalid JSON: \n\n```python\n# File api.py\n\nfrom fastapi import FastAPI\nfrom starlette.responses import PlainTextResponse\n\napp = FastAPI()\n\n@[USER].get(\"\/\")\nasync def root():\n # An invalid json string returned by the endpoint that will trigger a JSONDecodeError when calling `res.json()`\n s = '{\"responseCode\":[\"706\"],\"data\":null}{\"responseCode\":[\"706\"],\"data\":null}'\n return PlainTextResponse(s, media_type=\"application\/json\", status_code=400)\n\n# Run the API:\n# $ uvicorn api:app --reload\n#\n# curl [URL] will return the invalid json\n```\n\nand the following \n\n```python\nfrom concurrent.futures import ProcessPoolExecutor\nfrom concurrent.futures.process import BrokenProcessPool\n\nimport requests\n\ndef my_task():\n response = requests.get('[URL]\n response.json()\n\ndef my_main_func():\n with ProcessPoolExecutor(max_workers=4) as executor:\n future = executor.submit(my_task)\n for i in range(0, 5):\n try:\n future.result(timeout=100)\n print(f\"Attempt {i} ok\")\n except BrokenProcessPool:\n print(f\"Attempt {i} - the pool is broken\")\n except requests.JSONDecodeError:\n print(f\"Attempt {i} raises a request JSONDecodeError\")\n\nif __name__ == '__main__':\n my_main_func()\n```\n\nInstead of getting the following output:\n```\nAttempt 0 raises a request JSONDecodeError\nAttempt 1 raises a request JSONDecodeError\nAttempt 2 raises a request JSONDecodeError\nAttempt 3 raises a request JSONDecodeError\nAttempt 4 raises a request JSONDecodeError\n```\n\nOne would currently have:\n```\nAttempt 0 - the pool is broken\nAttempt 1 - the pool is broken\nAttempt 2 - the pool is broken\nAttempt 3 - the pool is broken\nAttempt 4 - the pool is broken\n```\n\nAn invalid JSON is crashing the entire process pool and no job can be submitted anymore.\n\n## System Information\n\nTested with:\n- request==2.31.0\n- Python==3.11.7\n\n-----\n\nThanks a lot for taking the time to read this long bug report!!","body_prose":"Hi all,\n\nI've stumbled upon a bug in the `requests` library, and have a proposal for a fix.\n\nIn short: I have a process pool running tasks in parallel, that are among other things doing queries to third-party APIs. One third-party returns an invalid JSON document as response in case of error.\n\nHowever, instead of just having a JSONDecodeError as the result of my job, the entire process pool crashes due to a BrokenProcessPool error with the following stack trace:\n\n [CODE] \n\nSo I'm in a situation where receiving one invalid JSON as response is interrupting all my ongoing tasks because the entire process pool is crashing, and no more tasks can be submitted until the process pool recovered.\n\n## Origin of the bug + Fix\n\nAfter investigation, this is because the `requests.exception.JSONDecodeError` instances can't be deserialized once they've been serialized via `pickle`. So when the main process is trying to deserialize the error returned by the child process, the main process is crashing with to the error above.\n\nI think this bug has been around for a while, I've found old tickets from different projects mentioning issues that are looking similar: [URL]\n\nI've pinpointed the bug to the following class: [URL]\n\nBasically, due the MRO\/order of inheritance, the `__reduce__` method used will not be the one of `CompatJSONDecodeError`. Most of the args will therefore be ditched when pickling the instance and it can't be deserialised back because `CompatJSONDecodeError.__init__` does expect those args. MRO below:\n\n [CODE] \n\nI think the fix could be quite simple and should have very little side-effects: to specify a `JSONDecodeError.__reduce__` method that will call the one from the correct parent class (it will be regardless that it is json\/simplejson via the Compat class, their respective methods having different signatures).\n\nI've taken the initiative to write a fix + a test and will raise a pull request to that effect 🙏 \n\n-----\n\n## Expected Result\n\nI've written a test for this case: the error can easily be reproduced by simply trying to `pickle.dumps()` then `pickle.loads()` on a error:\n\n [CODE] \n\nThis assertion should be true\n\n## Actual Result\n\nCurrently, instead of passing it'll raise the following error:\n\n [CODE] \n\n## Reproduction Steps\n\nAs mentioned above, this bug is more impactful in a multi-process architecture as it'll break the entire process pool.\nFor something looking a bit more like a live-case, I've produced a little snippet with a really simple API returning an invalid JSON: \n\n [CODE] \n\nand the following \n\n [CODE] \n\nInstead of getting the following output:\n [CODE] \n\nOne would currently have:\n [CODE] \n\nAn invalid JSON is crashing the entire process pool and no job can be submitted anymore.\n\n## System Information\n\nTested with:\n- request==2.31.0\n- Python==3.11.7\n\n-----\n\nThanks a lot for taking the time to read this long bug report!!","text":"[BUG] JSONDecodeError can't be deserialized - invalid JSON raises a BrokenProcessPool and crashes the entire process pool. Hi all,\n\nI've stumbled upon a bug in the `requests` library, and have a proposal for a fix.\n\nIn short: I have a process pool running tasks in parallel, that are among other things doing queries to third-party APIs. One third-party returns an invalid JSON document as response in case of error.\n\nHowever, instead of just having a JSONDecodeError as the result of my job, the entire process pool crashes due to a BrokenProcessPool error with the following stack trace:\n\n [CODE] \n\nSo I'm in a situation where receiving one invalid JSON as response is interrupting all my ongoing tasks because the entire process pool is crashing, and no more tasks can be submitted until the process pool recovered.\n\n## Origin of the bug + Fix\n\nAfter investigation, this is because the `requests.exception.JSONDecodeError` instances can't be deserialized once they've been serialized via `pickle`. So when the main process is trying to deserialize the error returned by the child process, the main process is crashing with to the error above.\n\nI think this bug has been around for a while, I've found old tickets from different projects mentioning issues that are looking similar: [URL]\n\nI've pinpointed the bug to the following class: [URL]\n\nBasically, due the MRO\/order of inheritance, the `__reduce__` method used will not be the one of `CompatJSONDecodeError`. Most of the args will therefore be ditched when pickling the instance and it can't be deserialised back because `CompatJSONDecodeError.__init__` does expect those args. MRO below:\n\n [CODE] \n\nI think the fix could be quite simple and should have very little side-effects: to specify a `JSONDecodeError.__reduce__` method that will call the one from the correct parent class (it will be regardless that it is json\/simplejson via the Compat class, their respective methods having different signatures).\n\nI've taken the initiative to write a fix + a test and will raise a pull request to that effect 🙏 \n\n-----\n\n## Expected Result\n\nI've written a test for this case: the error can easily be reproduced by simply trying to `pickle.dumps()` then `pickle.loads()` on a error:\n\n [CODE] \n\nThis assertion should be true\n\n## Actual Result\n\nCurrently, instead of passing it'll raise the following error:\n\n [CODE] \n\n## Reproduction Steps\n\nAs mentioned above, this bug is more impactful in a multi-process architecture as it'll break the entire process pool.\nFor something looking a bit more like a live-case, I've produced a little snippet with a really simple API returning an invalid JSON: \n\n [CODE] \n\nand the following \n\n [CODE] \n\nInstead of getting the following output:\n [CODE] \n\nOne would currently have:\n [CODE] \n\nAn invalid JSON is crashing the entire process pool and no job can be submitted anymore.\n\n## System Information\n\nTested with:\n- request==2.31.0\n- Python==3.11.7\n\n-----\n\nThanks a lot for taking the time to read this long bug report!!","comments":["As mentioned I've raised [URL] hopefully the proposal makes sense."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-01-31T16:06:02Z","closed_at":"2024-02-22T20:27:39Z","updated_at":"2025-05-16T00:04:53Z","days_to_close":22.18,"created_year_month":"2024-01","labels":[],"issue_type":"bug","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":null,"reactions_total":0,"author_id":"user_0262","author_association":"CONTRIBUTOR","comment_author_ids":["user_0262"],"comment_author_roles":["CONTRIBUTOR"],"comment_by_issue_author":[true],"has_code_block":true,"has_traceback":true,"title_words":17,"body_words":460,"locked":true}
{"number":6630,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6630","title":"Multipart\/form-data requests creates mismatched boundaries between request body and headers","body_clean":"## Expected Result\nmultipart\/form-data requests should have the same boundary in the request content-type headers and request body:\n\nContent-Type header: `multipart\/form-data; boundary=bb8517293e3e961b2e7dfbd4e303fe56`\nBoundary for request body: `--bb8517293e3e961b2e7dfbd4e303fe56`\n## Actual Result\nmultipart\/form-data requests have different boundaries in the request content-type headers and request body:\n\nContent-Type header: `multipart\/form-data; boundary=bb8517293e3e961b2e7dfbd4e303fe56`\nBoundary for request body: `--42fdbee1e9d775f1239dda28331699a7`\n\n## Reproduction Steps\n\n```python\nimport requests\nsession = requests.session()\n\ndata = {\n \"name\": \"test\",\n \"description\": \"test\",\n}\nfiles = {'upload_file': open(\"yourfile.txt\", \"rb\")}\nreq = session.post(\"[URL] files=files, data=data)\n\nprint(\"Request Headers: \" + str(req.request.headers))\nprint(\"Request Body: \" + str(req.request.body))\nprint(\"Status Code: \" + str(req.status_code))\nprint(\"Response Headers: \" + str(req.headers))\nprint(\"Response Body: \" + str(req.text))\n```\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{\n \"chardet\": {\n \"version\": \"3.0.4\"\n },\n \"charset_normalizer\": {\n \"version\": \"2.1.0\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"2.10\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.10.7\"\n },\n \"platform\": {\n \"release\": \"10\",\n \"system\": \"Windows\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"1010111f\"\n },\n \"urllib3\": {\n \"version\": \"1.26.11\"\n },\n \"using_charset_normalizer\": false,\n \"using_pyopenssl\": false\n}\n```","body_prose":"## Expected Result\nmultipart\/form-data requests should have the same boundary in the request content-type headers and request body:\n\nContent-Type header: `multipart\/form-data; boundary=bb8517293e3e961b2e7dfbd4e303fe56`\nBoundary for request body: `--bb8517293e3e961b2e7dfbd4e303fe56`\n## Actual Result\nmultipart\/form-data requests have different boundaries in the request content-type headers and request body:\n\nContent-Type header: `multipart\/form-data; boundary=bb8517293e3e961b2e7dfbd4e303fe56`\nBoundary for request body: `--42fdbee1e9d775f1239dda28331699a7`\n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"Multipart\/form-data requests creates mismatched boundaries between request body and headers. ## Expected Result\nmultipart\/form-data requests should have the same boundary in the request content-type headers and request body:\n\nContent-Type header: `multipart\/form-data; boundary=bb8517293e3e961b2e7dfbd4e303fe56`\nBoundary for request body: `--bb8517293e3e961b2e7dfbd4e303fe56`\n## Actual Result\nmultipart\/form-data requests have different boundaries in the request content-type headers and request body:\n\nContent-Type header: `multipart\/form-data; boundary=bb8517293e3e961b2e7dfbd4e303fe56`\nBoundary for request body: `--42fdbee1e9d775f1239dda28331699a7`\n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["I cannot reproduce this at all. The only time the boundary tends to differ in the header from what's in the body is when the user overrides the Content-Type header manually.\n\nIn the future, please search **closed and** open issues before creating new ones that are duplicates."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-02-01T19:04:24Z","closed_at":"2024-02-03T12:26:40Z","updated_at":"2025-02-03T00:04:31Z","days_to_close":1.72,"created_year_month":"2024-02","labels":["Question\/Not a bug"],"issue_type":"question","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":41.37,"reactions_total":0,"author_id":"user_0451","author_association":"NONE","comment_author_ids":["user_0028"],"comment_author_roles":["CONTRIBUTOR"],"comment_by_issue_author":[false],"has_code_block":true,"has_traceback":false,"title_words":10,"body_words":64,"locked":true}
{"number":6631,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6631","title":"`params` might be misnamed?","body_clean":"### Summary\n\nBeing a bit pedantic but isn't it that the `parameters` of a URL are a \";\" affair inside the path e.g. `[URL] ([RFC source]([URL] and [summary]([URL] and what Requests calls `params` is actually the `query`.. which I long have been calling the \"querystring\" thanks to my days of Classic ASP programming referencing the \"query string\" ([URL] and [URL]\n\n[Documentation calls them part of the query string too]([URL]\n\n \n\n### What you expected\n\nGood question, maybe the keyword to be `query`? But I highly doubt there will be any aspiration to start renaming the library's keywords at this late stage in a way that would cause a breaking change (unless both were accepted and one was mapped to the other). Validation I guess that I am right (or a correction if I am wrong)?","body_prose":"### Summary\n\nBeing a bit pedantic but isn't it that the `parameters` of a URL are a \";\" affair inside the path e.g. `[URL] ([RFC source]([URL] and [summary]([URL] and what Requests calls `params` is actually the `query`.. which I long have been calling the \"querystring\" thanks to my days of Classic ASP programming referencing the \"query string\" ([URL] and [URL]\n\n[Documentation calls them part of the query string too]([URL]\n\n \n\n### What you expected\n\nGood question, maybe the keyword to be `query`? But I highly doubt there will be any aspiration to start renaming the library's keywords at this late stage in a way that would cause a breaking change (unless both were accepted and one was mapped to the other). Validation I guess that I am right (or a correction if I am wrong)?","text":"`params` might be misnamed?. ### Summary\n\nBeing a bit pedantic but isn't it that the `parameters` of a URL are a \";\" affair inside the path e.g. `[URL] ([RFC source]([URL] and [summary]([URL] and what Requests calls `params` is actually the `query`.. which I long have been calling the \"querystring\" thanks to my days of Classic ASP programming referencing the \"query string\" ([URL] and [URL]\n\n[Documentation calls them part of the query string too]([URL]\n\n \n\n### What you expected\n\nGood question, maybe the keyword to be `query`? But I highly doubt there will be any aspiration to start renaming the library's keywords at this late stage in a way that would cause a breaking change (unless both were accepted and one was mapped to the other). Validation I guess that I am right (or a correction if I am wrong)?","comments":["Parameters is another common name for the parsed (not encoded) pieces of the query string. `params` are meant to be passed as a native python object (e.g., dictionary of string to string, sequence of tuples of length 2, etc). So if you parsed a query string into parameters on the server side, the client side would take parameters and encode them into the query string \n\nEdit to add: \n\n- [URL]\n- [URL]\n- [URL]\n- [URL]\n- [URL]\n- [URL]\n- [URL]\n\nNone of this is to say you're wrong and we're right, just that it's not uncommon for the query string to be called query parameters or parameters for short"],"state":"closed","state_reason":"not_planned","is_closed":true,"created_at":"2024-02-02T13:29:53Z","closed_at":"2024-02-03T10:11:54Z","updated_at":"2025-02-03T00:04:32Z","days_to_close":0.86,"created_year_month":"2024-02","labels":[],"issue_type":"question","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":2.14,"reactions_total":0,"author_id":"user_0450","author_association":"NONE","comment_author_ids":["user_0028"],"comment_author_roles":["CONTRIBUTOR"],"comment_by_issue_author":[false],"has_code_block":false,"has_traceback":false,"title_words":4,"body_words":134,"locked":true}
{"number":6633,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6633","title":"Getting warning while running databricks cli command in azure devops","body_clean":"Hello team,\n\ni am using Databricks Cli for deployment of notebooks on azure and it is throwing below warning. Could you help me to resolve warning? Also i am using pip install --upgrade urllib3 chardet command to upgrade but still it is giving warning.\n\/usr\/lib\/python3\/dist-packages\/requests\/__init__.py:87: RequestsDependencyWarning: urllib3 (2.2.0) or chardet (4.0.0) doesn't match a supported version!\n warnings.warn(\"urllib3 ({}) or chardet ({}) doesn't match a supported \"\n\n## Expected Result\n I want to ignore\/resolve the warning.\n \n\n## Actual Result\n It is throwing warning as below\n\/usr\/lib\/python3\/dist-packages\/requests\/__init__.py:87: RequestsDependencyWarning: urllib3 (2.2.0) or chardet (4.0.0) doesn't match a supported version!\n warnings.warn(\"urllib3 ({}) or chardet ({}) doesn't match a supported \"","body_prose":"Hello team,\n\ni am using Databricks Cli for deployment of notebooks on azure and it is throwing below warning. Could you help me to resolve warning? Also i am using pip install --upgrade urllib3 chardet command to upgrade but still it is giving warning.\n\/usr\/lib\/python3\/dist-packages\/requests\/__init__.py:87: RequestsDependencyWarning: urllib3 (2.2.0) or chardet (4.0.0) doesn't match a supported version!\n warnings.warn(\"urllib3 ({}) or chardet ({}) doesn't match a supported \"\n\n## Expected Result\n I want to ignore\/resolve the warning.\n \n\n## Actual Result\n It is throwing warning as below\n\/usr\/lib\/python3\/dist-packages\/requests\/__init__.py:87: RequestsDependencyWarning: urllib3 (2.2.0) or chardet (4.0.0) doesn't match a supported version!\n warnings.warn(\"urllib3 ({}) or chardet ({}) doesn't match a supported \"","text":"Getting warning while running databricks cli command in azure devops. Hello team,\n\ni am using Databricks Cli for deployment of notebooks on azure and it is throwing below warning. Could you help me to resolve warning? Also i am using pip install --upgrade urllib3 chardet command to upgrade but still it is giving warning.\n\/usr\/lib\/python3\/dist-packages\/requests\/__init__.py:87: RequestsDependencyWarning: urllib3 (2.2.0) or chardet (4.0.0) doesn't match a supported version!\n warnings.warn(\"urllib3 ({}) or chardet ({}) doesn't match a supported \"\n\n## Expected Result\n I want to ignore\/resolve the warning.\n \n\n## Actual Result\n It is throwing warning as below\n\/usr\/lib\/python3\/dist-packages\/requests\/__init__.py:87: RequestsDependencyWarning: urllib3 (2.2.0) or chardet (4.0.0) doesn't match a supported version!\n warnings.warn(\"urllib3 ({}) or chardet ({}) doesn't match a supported \"","comments":["Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow]([URL] for general usage questions instead and only report defects here."],"state":"closed","state_reason":"not_planned","is_closed":true,"created_at":"2024-02-05T20:15:08Z","closed_at":"2024-02-05T20:18:37Z","updated_at":"2024-02-05T20:18:40Z","days_to_close":0.0,"created_year_month":"2024-02","labels":[],"issue_type":"bug","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":0.06,"reactions_total":0,"author_id":"user_0449","author_association":"NONE","comment_author_ids":["user_0028"],"comment_author_roles":["CONTRIBUTOR"],"comment_by_issue_author":[false],"has_code_block":false,"has_traceback":false,"title_words":10,"body_words":106,"locked":true}
{"number":6635,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6635","title":"IPv6 address change for sequential gets","body_clean":"I'm not sure, if the following issue is caused by requests or one of the underlying libraries. \nThe library [python-fritzhome]([URL] uses requests to connect to the HTTP interface of a router called FRITZ!Box. During sequential get calls, the IPv6 address is switched.\nI already opened an [issue]([URL] for the mentioned library, but got no solution.\n\n## Expected Result\n\nAll connections of the same session object are made using the same IPv6 address.\n\n## Actual Result\n\nThe third get request uses a different IPv6 address (extract of a tcpdump record):\n\nrsp = s.get('[URL]\nrsp.raise_for_status()\ntime.sleep(0.5)\nrsp = s.get('[URL]\nrsp.raise_for_status()\ntime.sleep(0.5)\nrsp = s.get('[URL]\nrsp.raise_for_status()\nprint(rsp.text.strip())\n```\n\n## System Information\n\nHardware and OS: Raspberry Pi 5, Raspberry Pi OS Lite 64 based on Debian 12\n\n $ python -m requests.help\n\n```json\n{\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"3.3.2\"\n },\n \"cryptography\": {\n \"version\": \"41.0.7\"\n },\n \"idna\": {\n \"version\": \"3.6\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.11.2\"\n },\n \"platform\": {\n \"release\": \"6.1.0-rpi8-rpi-2712\",\n \"system\": \"Linux\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"30100040\",\n \"version\": \"23.2.0\"\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"300000b0\"\n },\n \"urllib3\": {\n \"version\": \"2.1.0\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": true\n}\n```","body_prose":"I'm not sure, if the following issue is caused by requests or one of the underlying libraries. \nThe library [python-fritzhome]([URL] uses requests to connect to the HTTP interface of a router called FRITZ!Box. During sequential get calls, the IPv6 address is switched.\nI already opened an [issue]([URL] for the mentioned library, but got no solution.\n\n## Expected Result\n\nAll connections of the same session object are made using the same IPv6 address.\n\n## Actual Result\n\nThe third get request uses a different IPv6 address (extract of a tcpdump record):\n:\n If you want to pin to a given IP address, you will want to specify it yourself. These all seem to be local addresses.\n\nTo get the ideal behaviour, you likely want to ensure:\n* The library you're using isn't disabling keep-alive\n* The server you're communicating with supports keep-alive\n* Anything you have between you and the server isn't preventing keep-alive."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-02-06T23:53:20Z","closed_at":"2024-02-07T13:06:38Z","updated_at":"2025-02-07T00:04:13Z","days_to_close":0.55,"created_year_month":"2024-02","labels":[],"issue_type":"bug","comments_reported":2,"n_comments_collected":2,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":13.22,"reactions_total":0,"author_id":"user_0261","author_association":"NONE","comment_author_ids":["user_0261","user_0028"],"comment_author_roles":["NONE","CONTRIBUTOR"],"comment_by_issue_author":[true,false],"has_code_block":true,"has_traceback":false,"title_words":6,"body_words":117,"locked":true}
{"number":6636,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6636","title":"requests Session and pool timeout.","body_clean":"Hi i want to know if it is possible for connections in session pool to have a timeout.\nFor example\n\n```\nimport requests\nimport time\n\nsess = requests.Session(pool_timeout=3)\n\nsess.get(\"[URL]\ntime.sleep(4)\nsess.get(\"[URL] # This creates a new connection and the previous is closed\n```\n\nI've found some answers that point to setting default_socket_options, but that doesn't seem to close sessions i always end up with this behaviour while logging.\n\n```\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\n\nimport requests\n\nimport time\n\nimport socket\nfrom urllib3.connection import HTTPConnection\n\nHTTPConnection.default_socket_options = ( HTTPConnection.default_socket_options + [\n (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1),\n (socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 1),\n (socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 1),\n (socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 1)\n ]\n)\n\nurl = '[URL]\n\nsess = requests.Session()\n\nfor x in range(2):\n data = sess.get(url)\n print(data)\n time.sleep(3)\n\n```\n\nThis doesn't start a new https connection, nor it does tell me if any of the socket options above is doing anything.\n```\nDEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): www.google.com:443\nDEBUG:urllib3.connectionpool:[URL] \"GET \/ HTTP\/1.1\" 200 None\n\n\nDEBUG:urllib3.connectionpool:[URL] \"GET \/ HTTP\/1.1\" 200 None\n\n```\n\nMaybe i'm missing some concept, but those socket options do not say that after 1 second of not sending requests, the socket should be closed?\n\nThanks","body_prose":"Hi i want to know if it is possible for connections in session pool to have a timeout.\nFor example\n\n [CODE] \n\nI've found some answers that point to setting default_socket_options, but that doesn't seem to close sessions i always end up with this behaviour while logging.\n\n [CODE] \n\nThis doesn't start a new https connection, nor it does tell me if any of the socket options above is doing anything.\n [CODE] \n\nMaybe i'm missing some concept, but those socket options do not say that after 1 second of not sending requests, the socket should be closed?\n\nThanks","text":"requests Session and pool timeout.. Hi i want to know if it is possible for connections in session pool to have a timeout.\nFor example\n\n [CODE] \n\nI've found some answers that point to setting default_socket_options, but that doesn't seem to close sessions i always end up with this behaviour while logging.\n\n [CODE] \n\nThis doesn't start a new https connection, nor it does tell me if any of the socket options above is doing anything.\n [CODE] \n\nMaybe i'm missing some concept, but those socket options do not say that after 1 second of not sending requests, the socket should be closed?\n\nThanks","comments":["As described in the template, we won't be able to answer questions on this issue tracker. Please use [Stack Overflow]([URL]"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-02-07T19:04:44Z","closed_at":"2024-02-07T19:04:56Z","updated_at":"2024-02-07T19:04:56Z","days_to_close":0.0,"created_year_month":"2024-02","labels":["Question\/Not a bug","actions\/autoclose-qa"],"issue_type":"question","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":0.0,"reactions_total":0,"author_id":"user_0448","author_association":"NONE","comment_author_ids":["user_0023"],"comment_author_roles":["NONE"],"comment_by_issue_author":[false],"has_code_block":true,"has_traceback":false,"title_words":5,"body_words":96,"locked":true}
{"number":6637,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6637","title":"[BUG] pytest error in python:3.8- (only work in 3.7) because httpbin uses deprecated werkzeug function 'parse_authorization_header'","body_clean":"# Summary\npytest error happens in python:3.8- (only work in 3.7) because httpbin uses **deprecated werkzeug function 'parse_authorization_header'**. Because of this, pytest don't work above python 3.8 version, and it could be a serious problem for requests.py contributers. \n\nI'm new to open source contributing, so if you have any suggestions, I'd appreciate it :)\n\n# How I found this error?\nAs python newcomer, I thought requests.py is the best library to learn about python, OOP, networking. So I cloned a code and ran pytest.\n\n## Expected Result\nI expected pytest working well, but the error occured.\n\n## Actual Result\n to reproduce the problem, and I found only python:3.7 works but higher versions are not. \n\nIn python:3.7, pytest running well.\n.** \nI would like contributors to be aware of the issues I mentioned. Thank you!","body_prose":"# Summary\npytest error happens in python:3.8- (only work in 3.7) because httpbin uses **deprecated werkzeug function 'parse_authorization_header'**. Because of this, pytest don't work above python 3.8 version, and it could be a serious problem for requests.py contributers. \n\nI'm new to open source contributing, so if you have any suggestions, I'd appreciate it :)\n\n# How I found this error?\nAs python newcomer, I thought requests.py is the best library to learn about python, OOP, networking. So I cloned a code and ran pytest.\n\n## Expected Result\nI expected pytest working well, but the error occured.\n\n## Actual Result\n to reproduce the problem, and I found only python:3.7 works but higher versions are not. \n\nIn python:3.7, pytest running well.\n.** \nI would like contributors to be aware of the issues I mentioned. Thank you!","text":"[BUG] pytest error in python:3.8- (only work in 3.7) because httpbin uses deprecated werkzeug function 'parse_authorization_header'. # Summary\npytest error happens in python:3.8- (only work in 3.7) because httpbin uses **deprecated werkzeug function 'parse_authorization_header'**. Because of this, pytest don't work above python 3.8 version, and it could be a serious problem for requests.py contributers. \n\nI'm new to open source contributing, so if you have any suggestions, I'd appreciate it :)\n\n# How I found this error?\nAs python newcomer, I thought requests.py is the best library to learn about python, OOP, networking. So I cloned a code and ran pytest.\n\n## Expected Result\nI expected pytest working well, but the error occured.\n\n## Actual Result\n to reproduce the problem, and I found only python:3.7 works but higher versions are not. \n\nIn python:3.7, pytest running well.\n.** \nI would like contributors to be aware of the issues I mentioned. Thank you!","comments":["In the future, please search **closed and** open issues before creating new ones that are duplicates.","> In the future, please search **closed and** open issues before creating new ones that are duplicates.\n\nThank you for your response, I will be more careful."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-02-09T10:32:47Z","closed_at":"2024-02-09T10:48:50Z","updated_at":"2025-02-09T00:04:48Z","days_to_close":0.01,"created_year_month":"2024-02","labels":[],"issue_type":"bug","comments_reported":2,"n_comments_collected":2,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":0.27,"reactions_total":0,"author_id":"user_0260","author_association":"NONE","comment_author_ids":["user_0028","user_0260"],"comment_author_roles":["CONTRIBUTOR","NONE"],"comment_by_issue_author":[false,true],"has_code_block":true,"has_traceback":false,"title_words":16,"body_words":311,"locked":true}
{"number":6639,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6639","title":"2.31.0: pytest fails in `tests\/test_requests.py::TestRequests::test_https_warnings` unit","body_clean":"I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.\n- `python3 -sBm build -w --no-isolation`\n- because I'm calling `build` with `--no-isolation` I'm using during all processes only locally installed modules\n- install .whl file in <\/install\/prefix> using 'installer` module\n- run pytest with $PYTHONPATH pointing to sitearch and sitelib inside <\/install\/prefix>\n- build is performed in env which is *`cut off from access to the public network`* (pytest is executed with `-m \"not network\"`)\n\n\nHere is pytest output:<\/summary>\n\n```console\n+ PYTHONPATH=\/home\/tkloczko\/rpmbuild\/BUILDROOT\/python-requests-2.31.0-4.fc35.x86_64\/usr\/lib64\/python3.8\/site-packages:\/home\/tkloczko\/rpmbuild\/BUILDROOT\/python-requests-2.31.0-4.fc35.x86_64\/usr\/lib\/python3.8\/site-packages\n+ \/usr\/bin\/pytest -ra -m 'not network' tests\n============================= test session starts ==============================\nplatform linux -- Python 3.8.18, pytest-8.0.0, pluggy-1.3.0\nrootdir: \/home\/tkloczko\/rpmbuild\/BUILD\/requests-2.31.0\nconfigfile: pyproject.toml\nplugins: httpbin-2.0.0, mock-3.12.0\ncollected 596 items\n\ntests\/test_help.py ... [ 0%]\ntests\/test_hooks.py ... [ 1%]\ntests\/test_lowlevel.py .................... [ 4%]\ntests\/test_packages.py ... [ 4%]\ntests\/test_requests.py ................................................. [ 13%]\n......................................................................Fpytest-httpbin server hit an exception serving request: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:1131)\nattempting to ignore so the rest of the tests can run\n. [ 25%]\n........................................................................ [ 37%]\n.....................................x.................................. [ 49%]\n........................................................ [ 58%]\ntests\/test_structures.py .................... [ 62%]\ntests\/test_testserver.py ......s.... [ 63%]\ntests\/test_utils.py ..s................................................. [ 72%]\n........................................................................ [ 84%]\n........................................................................ [ 96%]\n...sssssssssss..... [100%]\n\n=================================== FAILURES ===================================\n_______________________ TestRequests.test_https_warnings _______________________\n\nself = \nnosan_server = ('localhost', 36135, '\/tmp\/pytest-of-tkloczko\/pytest-145\/certs0\/ca.pem')\n\n @[USER].mark.skipif(\n SNIMissingWarning is None,\n reason=\"urllib3 2.0 removed that warning and errors out instead\",\n )\n def test_https_warnings(self, nosan_server):\n \"\"\"warnings are emitted with requests.get\"\"\"\n host, port, ca_bundle = nosan_server\n if HAS_MODERN_SSL or HAS_PYOPENSSL:\n warnings_expected = (\"SubjectAltNameWarning\",)\n else:\n warnings_expected = (\n \"SNIMissingWarning\",\n \"InsecurePlatformWarning\",\n \"SubjectAltNameWarning\",\n )\n\n> with pytest.warns(None) as warning_records:\n\ntests\/test_requests.py:1014:\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\nself = WarningsChecker(record=True), expected_warning = None, match_expr = None\n\n def __init__(\n self,\n expected_warning: Optional[\n Union[Type[Warning], Tuple[Type[Warning], ...]]\n ] = Warning,\n match_expr: Optional[Union[str, Pattern[str]]] = None,\n *,\n _ispytest: bool = False,\n ) -> None:\n check_ispytest(_ispytest)\n super().__init__(_ispytest=True)\n\n msg = \"exceptions must be derived from Warning, not %s\"\n if expected_warning is None:\n> warnings.warn(WARNS_NONE_ARG, stacklevel=4)\nE pytest.PytestRemovedIn8Warning: Passing None has been deprecated.\nE See [URL] for alternatives in common use cases.\n\n\/usr\/lib\/python3.8\/site-packages\/_pytest\/recwarn.py:279: PytestRemovedIn8Warning\n================================== XFAILURES ===================================\n_______________ TestRequests.test_response_iter_lines_reentrant ________________\n\nself = \nhttpbin = .inner at 0x7f08b08c8ee0>\n\n @[USER].mark.xfail\n def test_response_iter_lines_reentrant(self, httpbin):\n \"\"\"Response.iter_lines() is not reentrant safe\"\"\"\n r = requests.get(httpbin(\"stream\/4\"), stream=True)\n assert r.status_code == 200\n\n next(r.iter_lines())\n> assert len(list(r.iter_lines())) == 3\nE assert 2 == 3\nE + where 2 = len([b'\"[URL] \"args\": {}, \"headers\": {\"Host\": \"127.0.0.1:43743\", \"User-Agent\": \"python-request...\"Accept-Encoding\": \"gzip, deflate, br\", \"Accept\": \"*\/*\", \"Connection\": \"keep-alive\"}, \"origin\": \"127.0.0.1\", \"id\": 3}'])\nE + where [b'\"[URL] \"args\": {}, \"headers\": {\"Host\": \"127.0.0.1:43743\", \"User-Agent\": \"python-request...\"Accept-Encoding\": \"gzip, deflate, br\", \"Accept\": \"*\/*\", \"Connection\": \"keep-alive\"}, \"origin\": \"127.0.0.1\", \"id\": 3}'] = list()\nE + where = >()\nE + where > = .iter_lines\n\ntests\/test_requests.py:2106: AssertionError\n----------------------------- Captured stderr call -----------------------------\n127.0.0.1 - - [14\/Feb\/2024 21:46:02] \"GET \/stream\/4 HTTP\/1.1\" 200 1008\n=============================== warnings summary ===============================\ntests\/test_requests.py::TestRequests::test_set_basicauth[42-42]\ntests\/test_requests.py::TestRequests::test_set_basicauth[42-42]\n \/home\/tkloczko\/rpmbuild\/BUILD\/requests-2.31.0\/requests\/auth.py:36: DeprecationWarning: Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (42) to a string or bytes object in the near future to avoid problems.\n warnings.warn(\n\ntests\/test_requests.py::TestRequests::test_set_basicauth[42-42]\ntests\/test_requests.py::TestRequests::test_set_basicauth[42-42]\n \/home\/tkloczko\/rpmbuild\/BUILD\/requests-2.31.0\/requests\/auth.py:46: DeprecationWarning: Non-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in () to a string or bytes object in the near future to avoid problems.\n warnings.warn(\n\ntests\/test_requests.py::TestRequests::test_set_basicauth[None-None]\ntests\/test_requests.py::TestRequests::test_set_basicauth[None-None]\n \/home\/tkloczko\/rpmbuild\/BUILD\/requests-2.31.0\/requests\/auth.py:36: DeprecationWarning: Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (None) to a string or bytes object in the near future to avoid problems.\n warnings.warn(\n\ntests\/test_requests.py::TestRequests::test_set_basicauth[None-None]\ntests\/test_requests.py::TestRequests::test_set_basicauth[None-None]\n \/home\/tkloczko\/rpmbuild\/BUILD\/requests-2.31.0\/requests\/auth.py:46: DeprecationWarning: Non-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in () to a string or bytes object in the near future to avoid problems.\n warnings.warn(\n\ntests\/test_utils.py::TestContentEncodingDetection::test_none\ntests\/test_utils.py::TestContentEncodingDetection::test_pragmas[]\ntests\/test_utils.py::TestContentEncodingDetection::test_pragmas[]\ntests\/test_utils.py::TestContentEncodingDetection::test_pragmas[]\ntests\/test_utils.py::TestContentEncodingDetection::test_pragmas[]\ntests\/test_utils.py::TestContentEncodingDetection::test_precedence\n \/home\/tkloczko\/rpmbuild\/BUILD\/requests-2.31.0\/requests\/utils.py:493: DeprecationWarning: In requests 3.0, get_encodings_from_content will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)\n warnings.warn(\n\n-- Docs: [URL]\n=========================== short test summary info ============================\nSKIPPED [1] tests\/test_testserver.py:94: this fails non-deterministically under pytest-xdist\nSKIPPED [1] tests\/test_utils.py:49: condition: cStringIO is None\nSKIPPED [10] tests\/test_utils.py:814: Test only on Windows\nSKIPPED [1] tests\/test_utils.py:867: Test only on Windows\nXFAIL tests\/test_requests.py::TestRequests::test_response_iter_lines_reentrant\nFAILED tests\/test_requests.py::TestRequests::test_https_warnings - pytest.Pyt...\n= 1 failed, 581 passed, 13 skipped, 1 xfailed, 14 warnings in 78.45s (0:01:18) =\n127.0.0.1 - - [14\/Feb\/2024 21:45:55] \"GET \/get HTTP\/1.1\" 200 210\n127.0.0.1 - - [14\/Feb\/2024 21:45:55] \"GET \/relative-redirect\/20 HTTP\/1.1\" 302 0\n127.0.0.1 - - [14\/Feb\/2024 21:45:56] \"GET \/get HTTP\/1.1\" 200 272\n127.0.0.1 - - [14\/Feb\/2024 21:45:56] \"GET \/cookies HTTP\/1.1\" 200 40\n127.0.0.1 - - [14\/Feb\/2024 21:45:56] \"HEAD \/get HTTP\/1.1\" 200 0\n127.0.0.1 - - [14\/Feb\/2024 21:46:00] \"GET \/get HTTP\/1.1\" 200 313\n127.0.0.1 - - [14\/Feb\/2024 21:46:00] \"POST \/post HTTP\/1.1\" 200 475\n127.0.0.1 - - [14\/Feb\/2024 21:46:01] \"GET \/get?f%C3%B8%C3%B8=f%C3%B8%C3%B8 HTTP\/1.1\" 200 340\n127.0.0.1 - - [14\/Feb\/2024 21:46:01] \"GET \/get?f%C3%B8%C3%B8=f%C3%B8%C3%B8 HTTP\/1.1\" 200 340\n127.0.0.1 - - [14\/Feb\/2024 21:46:01] \"GET \/get?foo=foo HTTP\/1.1\" 200 300\n127.0.0.1 - - [14\/Feb\/2024 21:46:01] \"PUT \/put HTTP\/1.1\" 200 447\n127.0.0.1 - - [14\/Feb\/2024 21:46:02] \"GET \/get HTTP\/1.1\" 200 272\n127.0.0.1 - - [14\/Feb\/2024 21:46:32] \"GET \/redirect-to?url=http%3A%2F%2Flocalhost%3A-1 HTTP\/1.1\" 302 0\n```\n<\/details>\n\n\nList of installed modules in build env:<\/summary>\n\n```console\nPackage Version\n----------------------------- --------\nalabaster 0.7.16\nattrs 23.2.0\nBabel 2.14.0\nblinker 1.6.2\nBrotli 1.1.0\nbuild 1.0.3\ncffi 1.16.0\nchardet 5.2.0\ncharset-normalizer 3.3.2\nclick 8.1.7\ncppclean 0.13\ncryptography 42.0.2\ndecorator 5.1.1\ndistro 1.9.0\ndnf 4.19.0\ndocutils 0.20.1\nexceptiongroup 1.1.3\nflasgger 0.9.7.1\nFlask 3.0.2\ngpg 1.23.2\ngreenlet 3.0.3\nhttpbin 0.10.1\nidna 3.6\nimagesize 1.4.1\nimportlib_metadata 7.0.1\nimportlib_resources 6.1.1\niniconfig 2.0.0\ninstaller 0.7.0\nitsdangerous 2.1.2\nJinja2 3.1.3\njsonschema 4.19.1\njsonschema-specifications 2023.7.1\nlibdnf 0.73.0\nMarkupSafe 2.1.3\nmistune 2.0.5\npackaging 23.2\npkgutil_resolve_name 1.3.10\npluggy 1.3.0\nply 3.11\npycparser 2.21\nPygments 2.17.2\npyproject_hooks 1.0.0\nPySocks 1.7.1\npytest 8.0.0\npytest-httpbin 2.0.0\npytest-mock 3.12.0\npython-dateutil 2.8.2\npytz 2024.1\nPyYAML 6.0.1\nreferencing 0.30.2\nrequests 2.31.0\nrpds-py 0.18.0\nsetuptools 69.1.0\nsix 1.16.0\nsnowballstemmer 2.2.0\nSphinx 7.1.2\nsphinxcontrib-applehelp 1.0.4\nsphinxcontrib-devhelp 1.0.5\nsphinxcontrib-htmlhelp 2.0.5\nsphinxcontrib-jsmath 1.0.1\nsphinxcontrib-qthelp 1.0.7\nsphinxcontrib-serializinghtml 1.1.10\ntomli 2.0.1\ntrustme 1.1.0\nurllib3 1.26.18\nWerkzeug 3.0.1\nwheel 0.42.0\nzipp 3.17.0\n```\n<\/details>\n\nPlease let me know if you need more details or want me to perform some diagnostics.","body_prose":"I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.\n- `python3 -sBm build -w --no-isolation`\n- because I'm calling `build` with `--no-isolation` I'm using during all processes only locally installed modules\n- install .whl file in <\/install\/prefix> using 'installer` module\n- run pytest with $PYTHONPATH pointing to sitearch and sitelib inside <\/install\/prefix>\n- build is performed in env which is *`cut off from access to the public network`* (pytest is executed with `-m \"not network\"`)\n\n\nHere is pytest output:<\/summary>\n\n [CODE] \n<\/details>\n\n\nList of installed modules in build env:<\/summary>\n\n [CODE] \n<\/details>\n\nPlease let me know if you need more details or want me to perform some diagnostics.","text":"2.31.0: pytest fails in `tests\/test_requests.py::TestRequests::test_https_warnings` unit. I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.\n- `python3 -sBm build -w --no-isolation`\n- because I'm calling `build` with `--no-isolation` I'm using during all processes only locally installed modules\n- install .whl file in <\/install\/prefix> using 'installer` module\n- run pytest with $PYTHONPATH pointing to sitearch and sitelib inside <\/install\/prefix>\n- build is performed in env which is *`cut off from access to the public network`* (pytest is executed with `-m \"not network\"`)\n\n\nHere is pytest output:<\/summary>\n\n [CODE] \n<\/details>\n\n\nList of installed modules in build env:<\/summary>\n\n [CODE] \n<\/details>\n\nPlease let me know if you need more details or want me to perform some diagnostics.","comments":["I've tested as well 2.31.0 + current master (a5a0e4b5) and it fails as well\n\n\n```console\n+ PYTHONPATH=\/home\/tkloczko\/rpmbuild\/BUILDROOT\/python-requests-2.31.0-4.fc35.x86_64\/usr\/lib64\/python3.8\/site-packages:\/home\/tkloczko\/rpmbuild\/BUILDROOT\/python-requests-2.31.0-4.fc35.x86_64\/usr\/lib\/python3.8\/site-packages\n+ \/usr\/bin\/pytest -ra -m 'not network' tests\n============================= test session starts ==============================\nplatform linux -- Python 3.8.18, pytest-8.0.0, pluggy-1.3.0\nrootdir: \/home\/tkloczko\/rpmbuild\/BUILD\/requests-2.31.0\nconfigfile: pyproject.toml\nplugins: httpbin-2.0.0, mock-3.12.0\ncollected 597 items\n\ntests\/test_help.py ... [ 0%]\ntests\/test_hooks.py ... [ 1%]\ntests\/test_lowlevel.py .................... [ 4%]\ntests\/test_packages.py ... [ 4%]\ntests\/test_requests.py ................................................. [ 13%]\n......................................................................Fpytest-httpbin server hit an exception serving request: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:1131)\nattempting to ignore so the rest of the tests can run\n. [ 25%]\n........................................................................ [ 37%]\n.....................................x.................................. [ 49%]\n......................................................... [ 58%]\ntests\/test_structures.py .................... [ 62%]\ntests\/test_testserver.py ......s.... [ 63%]\ntests\/test_utils.py ..s................................................. [ 72%]\n...........................F............................................ [ 84%]\n........................................................................ [ 96%]\n...sssssssssss..... [100%]\n\n=================================== FAILURES ===================================\n_______________________ TestRequests.test_https_warnings _______________________\n\nself = \nnosan_server = ('localhost', 37739, '\/tmp\/pytest-of-tkloczko\/pytest-152\/certs0\/ca.pem')\n\n @[USER].mark.skipif(\n SNIMissingWarning is None,\n reason=\"urllib3 2.0 removed that warning and errors out instead\",\n )\n def test_https_warnings(self, nosan_server):\n \"\"\"warnings are emitted with requests.get\"\"\"\n host, port, ca_bundle = nosan_server\n if HAS_MODERN_SSL or HAS_PYOPENSSL:\n warnings_expected = (\"SubjectAltNameWarning\",)\n else:\n warnings_expected = (\n \"SNIMissingWarning\",\n \"InsecurePlatformWarning\",\n \"SubjectAltNameWarning\",\n )\n\n> with pytest.warns(None) as warning_records:\n\ntests\/test_requests.py:1004:\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\nself = WarningsChecker(record=True), expected_warning = None, match_expr = None\n\n def __init__(\n self,\n expected_warning: Optional[\n Union[Type[Warning], Tuple[Type[Warning], ...]]\n ] = Warning,\n match_expr: Optional[Union[str, Pattern[str]]] = None,\n *,\n _ispytest: bool = False,\n ) -> None:\n check_ispytest(_ispytest)\n super().__init__(_ispytest=True)\n\n msg = \"exceptions must be derived from Warning, not %s\"\n if expected_warning is None:\n> warnings.warn(WARNS_NONE_ARG, stacklevel=4)\nE pytest.PytestRemovedIn8Warning: Passing None has been deprecated.\nE See [URL] for alternatives in common use cases.\n\n\/usr\/lib\/python3.8\/site-packages\/_pytest\/recwarn.py:279: PytestRemovedIn8Warning\n______________ TestExtractZippedPaths.test_zipped_paths_extracted ______________\n\nself = \ntmpdir = local('\/tmp\/pytest-of-tkloczko\/pytest-152\/test_zipped_paths_extracted0')\n\n def test_zipped_paths_extracted(self, tmpdir):\n zipped_py = tmpdir.join(\"test.zip\")\n with zipfile.ZipFile(zipped_py.strpath, \"w\") as f:\n f.write(__file__)\n\n _, name = os.path.splitdrive(__file__)\n zipped_path = os.path.join(zipped_py.strpath, name.lstrip(r\"\\\/\"))\n extracted_path = extract_zipped_paths(zipped_path)\n\n assert extracted_path != zipped_path\n assert os.path.exists(extracted_path)\n> assert filecmp.cmp(extracted_path, __file__)\nE AssertionError: assert False\nE + where False = ('\/tmp\/test_utils.py', '\/home\/tkloczko\/rpmbuild\/BUILD\/requests-2.31.0\/tests\/test_utils.py')\nE + where = filecmp.cmp\n\ntests\/test_utils.py:337: AssertionError\n================================== XFAILURES ===================================\n_______________ TestRequests.test_response_iter_lines_reentrant ________________\n\nself = \nhttpbin = .inner at 0x7fe9478564c0>\n\n @[USER].mark.xfail\n def test_response_iter_lines_reentrant(self, httpbin):\n \"\"\"Response.iter_lines() is not reentrant safe\"\"\"\n r = requests.get(httpbin(\"stream\/4\"), stream=True)\n assert r.status_code == 200\n\n next(r.iter_lines())\n> assert len(list(r.iter_lines())) == 3\nE assert 2 == 3\nE + where 2 = len([b'\"[URL] \"args\": {}, \"headers\": {\"Host\": \"127.0.0.1:36813\", \"User-Agent\": \"python-request...\"Accept-Encoding\": \"gzip, deflate, br\", \"Accept\": \"*\/*\", \"Connection\": \"keep-alive\"}, \"origin\": \"127.0.0.1\", \"id\": 3}'])\nE + where [b'\"[URL] \"args\": {}, \"headers\": {\"Host\": \"127.0.0.1:36813\", \"User-Agent\": \"python-request...\"Accept-Encoding\": \"gzip, deflate, br\", \"Accept\": \"*\/*\", \"Connection\": \"keep-alive\"}, \"origin\": \"127.0.0.1\", \"id\": 3}'] = list()\nE + where = >()\nE + where > = .iter_lines\n\ntests\/test_requests.py:2093: AssertionError\n----------------------------- Captured stderr call -----------------------------\n127.0.0.1 - - [14\/Feb\/2024 22:52:05] \"GET \/stream\/4 HTTP\/1.1\" 200 1008\n=============================== warnings summary ===============================\ntests\/test_requests.py::TestRequests::test_set_basicauth[42-42]\ntests\/test_requests.py::TestRequests::test_set_basicauth[42-42]\n \/home\/tkloczko\/rpmbuild\/BUILDROOT\/python-requests-2.31.0-4.fc35.x86_64\/usr\/lib\/python3.8\/site-packages\/requests\/auth.py:36: DeprecationWarning: Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (42) to a string or bytes object in the near future to avoid problems.\n warnings.warn(\n\ntests\/test_requests.py::TestRequests::test_set_basicauth[42-42]\ntests\/test_requests.py::TestRequests::test_set_basicauth[42-42]\n \/home\/tkloczko\/rpmbuild\/BUILDROOT\/python-requests-2.31.0-4.fc35.x86_64\/usr\/lib\/python3.8\/site-packages\/requests\/auth.py:46: DeprecationWarning: Non-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in () to a string or bytes object in the near future to avoid problems.\n warnings.warn(\n\ntests\/test_requests.py::TestRequests::test_set_basicauth[None-None]\ntests\/test_requests.py::TestRequests::test_set_basicauth[None-None]\n \/home\/tkloczko\/rpmbuild\/BUILDROOT\/python-requests-2.31.0-4.fc35.x86_64\/usr\/lib\/python3.8\/site-packages\/requests\/auth.py:36: DeprecationWarning: Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (None) to a string or bytes object in the near future to avoid problems.\n warnings.warn(\n\ntests\/test_requests.py::TestRequests::test_set_basicauth[None-None]\ntests\/test_requests.py::TestRequests::test_set_basicauth[None-None]\n \/home\/tkloczko\/rpmbuild\/BUILDROOT\/python-requests-2.31.0-4.fc35.x86_64\/usr\/lib\/python3.8\/site-packages\/requests\/auth.py:46: DeprecationWarning: Non-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in () to a string or bytes object in the near future to avoid problems.\n warnings.warn(\n\ntests\/test_utils.py::TestContentEncodingDetection::test_none\ntests\/test_utils.py::TestContentEncodingDetection::test_pragmas[]\ntests\/test_utils.py::TestContentEncodingDetection::test_pragmas[]\ntests\/test_utils.py::TestContentEncodingDetection::test_pragmas[]\ntests\/test_utils.py::TestContentEncodingDetection::test_pragmas[]\ntests\/test_utils.py::TestContentEncodingDetection::test_precedence\n \/home\/tkloczko\/rpmbuild\/BUILDROOT\/python-requests-2.31.0-4.fc35.x86_64\/usr\/lib\/python3.8\/site-packages\/requests\/utils.py:489: DeprecationWarning: In requests 3.0, get_encodings_from_content will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)\n warnings.warn(\n\n-- Docs: [URL]\n=========================== short test summary info ============================\nSKIPPED [1] tests\/test_testserver.py:94: this fails non-deterministically under pytest-xdist\nSKIPPED [1] tests\/test_utils.py:50: condition: cStringIO is None\nSKIPPED [10] tests\/test_utils.py:815: Test only on Windows\nSKIPPED [1] tests\/test_utils.py:868: Test only on Windows\nXFAIL tests\/test_requests.py::TestRequests::test_response_iter_lines_reentrant\nFAILED tests\/test_requests.py::TestRequests::test_https_warnings - pytest.Pyt...\nFAILED tests\/test_utils.py::TestExtractZippedPaths::test_zipped_paths_extracted\n= 2 failed, 581 passed, 13 skipped, 1 xfailed, 14 warnings in 78.67s (0:01:18) =\n127.0.0.1 - - [14\/Feb\/2024 22:51:58] \"GET \/relative-redirect\/45 HTTP\/1.1\" 302 0\n127.0.0.1 - - [14\/Feb\/2024 22:51:58] \"GET \/cookies HTTP\/1.1\" 200 40\n127.0.0.1 - - [14\/Feb\/2024 22:51:58] \"HEAD \/get HTTP\/1.1\" 200 0\n127.0.0.1 - - [14\/Feb\/2024 22:52:02] \"GET \/get HTTP\/1.1\" 200 313\n127.0.0.1 - - [14\/Feb\/2024 22:52:03] \"GET \/get?f%C3%B8%C3%B8=f%C3%B8%C3%B8 HTTP\/1.1\" 200 340\n127.0.0.1 - - [14\/Feb\/2024 22:52:03] \"GET \/get?foo=foo HTTP\/1.1\" 200 300\n127.0.0.1 - - [14\/Feb\/2024 22:52:04] \"GET \/get HTTP\/1.1\" 200 272\n127.0.0.1 - - [14\/Feb\/2024 22:52:05] \"GET \/get HTTP\/1.1\" 200 272\n```\n<\/details>","The issue is originating from your upgrading outside of our currently defined [testing infrastructure requirements]([URL] We do not currently support pytest 8.0.0 which is the source of your test failures. Please run the tests with the prescribed requirements, otherwise this will be addressed when support for pytest 8.0 is added.","If it is issue related to use pytest 8.x IMO better would be keep this ticket opened with only renamed subject as sooner or later move to pytest 8 needs to be done."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-02-14T22:45:59Z","closed_at":"2024-02-14T23:22:05Z","updated_at":"2025-02-14T00:04:12Z","days_to_close":0.03,"created_year_month":"2024-02","labels":[],"issue_type":"bug","comments_reported":3,"n_comments_collected":3,"comments_complete":true,"maintainer_replied":true,"hours_to_first_response":0.6,"reactions_total":0,"author_id":"user_0259","author_association":"NONE","comment_author_ids":["user_0259","user_0007","user_0259"],"comment_author_roles":["NONE","MEMBER","NONE"],"comment_by_issue_author":[true,false,true],"has_code_block":true,"has_traceback":false,"title_words":6,"body_words":126,"locked":true}
{"number":6643,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6643","title":"Leading slash in uri followed by column fails","body_clean":"Leading slash in uri followed by column fails.\n\n## Expected Result\n\n```python\nrequests.get('[URL]\n\n```\n\n## Actual Result\n\n```python\nTraceback (most recent call last):\n File \"\/usr\/local\/lib\/python3.11\/site-packages\/urllib3\/util\/url.py\", line 425, in parse_url\n host, port = _HOST_PORT_RE.match(host_port).groups() # type: ignore[union-attr]\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'NoneType' object has no attribute 'groups'\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"\/usr\/local\/lib\/python3.11\/site-packages\/requests\/api.py\", line 73, in get\n return request(\"get\", url, params=params, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\/usr\/local\/lib\/python3.11\/site-packages\/requests\/api.py\", line 59, in request\n return session.request(method=method, url=url, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\/usr\/local\/lib\/python3.11\/site-packages\/requests\/sessions.py\", line 589, in request\n resp = self.send(prep, **send_kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\/usr\/local\/lib\/python3.11\/site-packages\/requests\/sessions.py\", line 703, in send\n r = adapter.send(request, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\/usr\/local\/lib\/python3.11\/site-packages\/requests\/adapters.py\", line 486, in send\n resp = conn.urlopen(\n ^^^^^^^^^^^^^\n File \"\/usr\/local\/lib\/python3.11\/site-packages\/urllib3\/connectionpool.py\", line 711, in urlopen\n parsed_url = parse_url(url)\n ^^^^^^^^^^^^^^\n File \"\/usr\/local\/lib\/python3.11\/site-packages\/urllib3\/util\/url.py\", line 451, in parse_url\n raise LocationParseError(source_url) from e\nurllib3.exceptions.LocationParseError: Failed to parse: \/\/v:h\n```\n\n## Reproduction Steps\n\n```python\nimport requests\nrequests.get('[URL]\n\n```\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"3.3.2\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.6\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.11.8\"\n },\n \"platform\": {\n \"release\": \"5.10.209-198.812.amzn2.x86_64\",\n \"system\": \"Linux\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"300000b0\"\n },\n \"urllib3\": {\n \"version\": \"2.2.1\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}\n```","body_prose":"Leading slash in uri followed by column fails.\n\n## Expected Result\n\n [CODE] \n\n## Actual Result\n\n [CODE] \n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"Leading slash in uri followed by column fails. Leading slash in uri followed by column fails.\n\n## Expected Result\n\n [CODE] \n\n## Actual Result\n\n [CODE] \n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["I can reproduce this with\n\n```py\nimport urllib3\n\nurllib3.PoolManager().urlopen(method=\"GET\", url=\"[URL]\n```\n\ncc @[USER] @[USER]","Ah I see the problem, both the PoolManager and requests are sending the path (`\/\/v:h`) to `urlopen`: [URL] [URL] and `urlopen` is now probably taking on too many responsibilities: [URL]","Also, yes, I verified that RFC3986 allows `:` as a non-percent-encoded character in the path: [URL]","And I think the problem is the `\/\/` in the path which is tripping up the parsing as `\/\/` is the delimiter for what should be host and port after that. So in reality nothing is wrong here. I wonder if we need some kind of pre-parsing of the URL before sending it to `urlopen` to trim this down. Something like `re.sub('^\/+', '\/')` would likely fix this in both Requests and urllib3.","Also reported this up to urllib3 [URL]","The urllib3 issue ([URL] is now resolved and a fix was released in 2.7.0. Requests will be reverting this patch as it's no longer needed. Anyone hitting this parsing edge case in Requests 2.34.0+ should upgrade to urllib3 2.7.0+."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-02-21T21:47:35Z","closed_at":"2024-02-23T00:49:43Z","updated_at":"2026-05-10T21:38:07Z","days_to_close":1.13,"created_year_month":"2024-02","labels":[],"issue_type":"bug","comments_reported":6,"n_comments_collected":6,"comments_complete":true,"maintainer_replied":true,"hours_to_first_response":3.09,"reactions_total":0,"author_id":"user_0446","author_association":"NONE","comment_author_ids":["user_0028","user_0028","user_0028","user_0028","user_0028","user_0007"],"comment_author_roles":["CONTRIBUTOR","CONTRIBUTOR","CONTRIBUTOR","CONTRIBUTOR","CONTRIBUTOR","MEMBER"],"comment_by_issue_author":[false,false,false,false,false,false],"has_code_block":true,"has_traceback":true,"title_words":8,"body_words":28,"locked":true}
{"number":6645,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6645","title":"('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))","body_clean":"can anyone help me with the below error\nError occurred ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))\nI am using requests==2.28.2 version and while logging into tableau server using rest api the error is coming.\nAs I am first creating the session and then doing the post request.","body_prose":"can anyone help me with the below error\nError occurred ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))\nI am using requests==2.28.2 version and while logging into tableau server using rest api the error is coming.\nAs I am first creating the session and then doing the post request.","text":"('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')). can anyone help me with the below error\nError occurred ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))\nI am using requests==2.28.2 version and while logging into tableau server using rest api the error is coming.\nAs I am first creating the session and then doing the post request.","comments":["Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow]([URL] for general usage questions instead and only report defects here."],"state":"closed","state_reason":"not_planned","is_closed":true,"created_at":"2024-02-22T15:19:13Z","closed_at":"2024-02-22T15:49:33Z","updated_at":"2025-02-22T00:04:10Z","days_to_close":0.02,"created_year_month":"2024-02","labels":[],"issue_type":"other","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":0.5,"reactions_total":0,"author_id":"user_0445","author_association":"NONE","comment_author_ids":["user_0028"],"comment_author_roles":["CONTRIBUTOR"],"comment_by_issue_author":[false],"has_code_block":false,"has_traceback":false,"title_words":8,"body_words":49,"locked":true}
{"number":6646,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6646","title":"`get_encoding_from_headers` fails if charset name not specified","body_clean":"`requests.utils.get_encoding_from_headers` assumes that the charset parameter always specifies a name. In very rare cases a server can send a malformed content-type header which does not specify a name. In these cases, requests should probably just treat it as if no charset had been specified.\n\n## Expected Result\n\n`requests.utils.get_encoding_from_headers({'content-type': 'text\/html; charset'}) == 'ISO-8859-1'`\n\n## Actual Result\n\n```\nFile ~\/opt\/anaconda3\/2023.03\/envs\/mamba\/envs\/py3\/lib\/python3.9\/site-packages\/requests\/utils.py:553, in get_encoding_from_headers(headers)\n 550 content_type, params = _parse_content_type_header(content_type)\n 552 if \"charset\" in params:\n--> 553 return params[\"charset\"].strip(\"'\\\"\")\n 555 if \"text\" in content_type:\n 556 return \"ISO-8859-1\"\n\nAttributeError: 'bool' object has no attribute 'strip'\n```\n\n## System Information\n\n```json\n{\n \"chardet\": {\n \"version\": \"4.0.0\"\n },\n \"charset_normalizer\": {\n \"version\": \"2.0.4\"\n },\n \"cryptography\": {\n \"version\": \"41.0.3\"\n },\n \"idna\": {\n \"version\": \"3.4\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.9.15\"\n },\n \"platform\": {\n \"release\": \"5.14.0-284.11.1.el9_2.x86_64\",\n \"system\": \"Linux\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"1010116f\",\n \"version\": \"23.2.0\"\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"1010117f\"\n },\n \"urllib3\": {\n \"version\": \"1.26.18\"\n },\n \"using_charset_normalizer\": false,\n \"using_pyopenssl\": true\n}\n```","body_prose":"`requests.utils.get_encoding_from_headers` assumes that the charset parameter always specifies a name. In very rare cases a server can send a malformed content-type header which does not specify a name. In these cases, requests should probably just treat it as if no charset had been specified.\n\n## Expected Result\n\n`requests.utils.get_encoding_from_headers({'content-type': 'text\/html; charset'}) == 'ISO-8859-1'`\n\n## Actual Result\n\n [CODE] \n\n## System Information\n\n [CODE]","text":"`get_encoding_from_headers` fails if charset name not specified. `requests.utils.get_encoding_from_headers` assumes that the charset parameter always specifies a name. In very rare cases a server can send a malformed content-type header which does not specify a name. In these cases, requests should probably just treat it as if no charset had been specified.\n\n## Expected Result\n\n`requests.utils.get_encoding_from_headers({'content-type': 'text\/html; charset'}) == 'ISO-8859-1'`\n\n## Actual Result\n\n [CODE] \n\n## System Information\n\n [CODE]","comments":["Hello @[USER] \nI just pushed a PR to fix this issue. It is my first PR in this project. Let's wait for project mantainer to validate my fix.\n\nBest Regards","I wonder if `_parse_content_type_header` should be changed so that it ignores parameters with no equals after them. Or sets them to the empty string, or None. Setting parameter values to a `bool` is clearly wrong.\n[src\/requests\/utils.py#L533]([URL]\n\nI have checked RFC 2045, RFC 2616, RFC 7231, RFC 9110 and they all define a parameter as essentially `parameter = parameter-name \"=\" parameter-value`, so a parameter with no equals character is technically invalid (I think?).\n\nComparing what some other implementations do:\n[mimeparse]([URL] (their implementation is taken directly from deprecated\/removed built-in [`cgi`]([URL] module, so should match what built-in `cgi` module used to do):\n```python\n>>> from mimeparse import parse_mime_type\n>>> parse_mime_type(\"application\/json; charset\")\n('application', 'json', {})\n```\nstdlib [`email.policy.EmailPolicy`]([URL] (tested using code from [this SO answer]([URL]\n```python\n>>> def parse_content_type(content_type):\n... from email.policy import EmailPolicy\n... header = EmailPolicy.header_factory('content-type', content_type)\n... return (header.content_type, dict(header.params))\n...\n>>> parse_content_type(\"application\/json; charset\")\n('application\/json', {'charset': ''})\n```\nstdlib [`email.message.Message`]([URL] (tested using code from [this SO answer]([URL]\n```python\n>>> from email.message import Message\n>>>\n>>> _CONTENT_TYPE = \"content-type\"\n>>>\n>>> def parse_content_type(content_type: str) -> tuple[str, dict[str,str]]:\n... email = Message()\n... email[_CONTENT_TYPE] = content_type\n... params = email.get_params()\n... # The first param is the mime-type the later ones are the attributes like \"charset\"\n... return params[0][0], dict(params[1:])\n...\n>>> parse_content_type(\"application\/json; charset\")\n('application\/json', {'charset': ''})\n```\n\n(Also, checking those implementations, you can see that they are more correct about quoted strings -- matching quotes\/unquoting -- but requests' simpler version of just splitting on \";\" and stripping any quote characters has been around for a long time and apparently not caused problems, so...)","This should be addressed in 2.33.1 with #7309."],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-02-22T23:56:00Z","closed_at":"2026-03-30T17:37:51Z","updated_at":"2026-03-30T17:37:51Z","days_to_close":766.74,"created_year_month":"2024-02","labels":[],"issue_type":"bug","comments_reported":3,"n_comments_collected":3,"comments_complete":true,"maintainer_replied":true,"hours_to_first_response":354.05,"reactions_total":0,"author_id":"user_0444","author_association":"NONE","comment_author_ids":["user_0250","user_0258","user_0007"],"comment_author_roles":["NONE","NONE","MEMBER"],"comment_by_issue_author":[false,false,false],"has_code_block":true,"has_traceback":false,"title_words":7,"body_words":60,"locked":false}
{"number":6647,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6647","title":"Wrong CA Certificates used in requests.Session.send","body_clean":"Bug in requests.sessions.py:\n\n[URL]\n\nsession.merge_environment_settings is called in session.request and not in session.send which means if users want to build their own prepared requests (see example below), the correct certificates file will not be used unless explicitly passed to send.\n\nI believe these environment settings should be updated in session.send instead.\n\n## Reproduction Steps\n\n```python\nimport os\nimport requests\n\n# Set CA certificates file to custom local file\nos.environ[\"REQUESTS_CA_BUNDLE\"] = \"\/etc\/ssl\/certs\/ca-certificates.crt\"\n\n# Create request object\nreq = requests.Request(\n method=\"GET\", # any method\n url=\"[URL] # any url for which the default cert file does not have a cert for\n)\n\nwith requests.Session() as s:\n respA = s.request( # Success: will use CA certificates from REQUESTS_CA_BUNDLE\n method=req.method,\n url=req.url\n )\n assert respA.status_code == 200\n \nwith requests.Session() as s:\n respB = s.send( # Success: will use CA certificates from REQUESTS_CA_BUNDLE if explicitly specified\n request=req.prepare(), verify=os.environ[\"REQUESTS_CA_BUNDLE\"]\n )\n \n assert respB.status_code == 200\n \nwith requests.Session() as s:\n respC = s.send( # Error: Will try to use default CA certificates instead of those specified by REQUESTS_CA_BUNDLE\n request=req.prepare() \n )\n \n assert respC.status_code == 200\n```\n\n## Expected Result\n\nNo output\n\n## Actual Result\n\n```\nrequests.exceptions.SSLError: HTTPSConnectionPool(host='[URL] port=443): Max retries exceeded with url: \/path (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))\n```\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"3.3.2\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.6\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.10.4\"\n },\n \"platform\": {\n \"release\": \"5.4.0-150-generic\",\n \"system\": \"Linux\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"30000020\"\n },\n \"urllib3\": {\n \"version\": \"2.2.1\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}\n```","body_prose":"Bug in requests.sessions.py:\n\n[URL]\n\nsession.merge_environment_settings is called in session.request and not in session.send which means if users want to build their own prepared requests (see example below), the correct certificates file will not be used unless explicitly passed to send.\n\nI believe these environment settings should be updated in session.send instead.\n\n## Reproduction Steps\n\n [CODE] \n\n## Expected Result\n\nNo output\n\n## Actual Result\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"Wrong CA Certificates used in requests.Session.send. Bug in requests.sessions.py:\n\n[URL]\n\nsession.merge_environment_settings is called in session.request and not in session.send which means if users want to build their own prepared requests (see example below), the correct certificates file will not be used unless explicitly passed to send.\n\nI believe these environment settings should be updated in session.send instead.\n\n## Reproduction Steps\n\n [CODE] \n\n## Expected Result\n\nNo output\n\n## Actual Result\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["I can confirm I'm seeing this behavior when using prepared requests and `sessions.send()`, being forced to set `session.verify = os.environ['REQUESTS_CA_BUNDLE']` before `send()`."],"state":"closed","state_reason":"duplicate","is_closed":true,"created_at":"2024-02-23T08:35:00Z","closed_at":"2025-10-01T22:30:53Z","updated_at":"2026-10-02T00:08:08Z","days_to_close":586.58,"created_year_month":"2024-02","labels":[],"issue_type":"bug","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":2340.6,"reactions_total":4,"author_id":"user_0443","author_association":"NONE","comment_author_ids":["user_0257"],"comment_author_roles":["NONE"],"comment_by_issue_author":[false],"has_code_block":true,"has_traceback":false,"title_words":6,"body_words":72,"locked":true}
{"number":6648,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6648","title":"POST with multiple files with the form-data sends only 1 file.","body_clean":"POSTing multiple files with a form-data. Using this doc: [URL]\n\nHowever only 1 file is received by the endpoint.\n\nBut if you change the files array (deviates from the documentation):\n\nfrom:\n```python\nfiles=[\n ('images',('image01.png',open('H:\/image01.png','rb'),'image\/png')),\n ('images',('image02.png',open('H:\/image02.png','rb'),'image\/png'))\n]\n```\n\nto:\n```python\nfiles=[\n ('images01',('image01.png',open('H:\/image01.png','rb'),'image\/png')),\n ('images02',('image02.png',open('H:\/image02.png','rb'),'image\/png'))\n]\n```\n\neverything works.\n\n## Expected Result\n\nReceiving endpoint gets an array with 2 items to iterate through them and save them as files.\n\n \n\n## Actual Result\n\nReceiving endpoint gets 1 item instead of 2 (or more if you are posting more).\n \n\n## Reproduction Steps\n\nTest script. For the endpoint you can run something of your own or even use `[URL]\n\n```python\nimport requests\nurl = \"[URL]\npayload = {}\nfiles=[\n ('images',('image01.png',open('H:\/image01.png','rb'),'image\/png')),\n ('images',('image02.png',open('H:\/image02.png','rb'),'image\/png'))\n]\nheaders = {}\nresponse = requests.post(url, files=files)\nprint(response.text)\n```\n\nEndpoint will get only 1 file. If you change files array to make `images` have separate value for each file = endpoint gets 2 files.\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"2.0.12\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.3\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.10.11\"\n },\n \"platform\": {\n \"release\": \"10\",\n \"system\": \"Windows\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.27.1\"\n },\n \"system_ssl\": {\n \"version\": \"1010114f\"\n },\n \"urllib3\": {\n \"version\": \"1.26.9\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}\n```","body_prose":"POSTing multiple files with a form-data. Using this doc: [URL]\n\nHowever only 1 file is received by the endpoint.\n\nBut if you change the files array (deviates from the documentation):\n\nfrom:\n [CODE] \n\nto:\n [CODE] \n\neverything works.\n\n## Expected Result\n\nReceiving endpoint gets an array with 2 items to iterate through them and save them as files.\n\n \n\n## Actual Result\n\nReceiving endpoint gets 1 item instead of 2 (or more if you are posting more).\n \n\n## Reproduction Steps\n\nTest script. For the endpoint you can run something of your own or even use `[URL]\n\n [CODE] \n\nEndpoint will get only 1 file. If you change files array to make `images` have separate value for each file = endpoint gets 2 files.\n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"POST with multiple files with the form-data sends only 1 file.. POSTing multiple files with a form-data. Using this doc: [URL]\n\nHowever only 1 file is received by the endpoint.\n\nBut if you change the files array (deviates from the documentation):\n\nfrom:\n [CODE] \n\nto:\n [CODE] \n\neverything works.\n\n## Expected Result\n\nReceiving endpoint gets an array with 2 items to iterate through them and save them as files.\n\n \n\n## Actual Result\n\nReceiving endpoint gets 1 item instead of 2 (or more if you are posting more).\n \n\n## Reproduction Steps\n\nTest script. For the endpoint you can run something of your own or even use `[URL]\n\n [CODE] \n\nEndpoint will get only 1 file. If you change files array to make `images` have separate value for each file = endpoint gets 2 files.\n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["Hello @[USER],\n\nAs request.post takes files as list in that also, this list should be _[(key,value)] or [{key,value}]_ which is checked by function **src.requests.utils.to_key_val_list()** and which make sense that there should be unique key. But, if it is working same key in older versions then it is bug in new one and it should be fixed.\n\n> For library perspective, we can create unique field name like this images_image01 or update readme document.\n\nI had tried with get request with same key but different values but it takes only last key and value. That's a reason this key should be unique in form-data also.\n\n.\nAfter creating my own endpoint using fastapi, I was able to see both files I uploaded.\n\n**Server:**\n```\nfrom fastapi import FastAPI, File, UploadFile\nfrom typing import List\n\napp = FastAPI()\n\n@[USER].post(\"\/upload\")\nasync def upload_files(images: List[UploadFile]):\n uploaded_files_info = []\n for file in images:\n content = await file.read()\n uploaded_files_info.append({\n \"filename\": file.filename,\n \"content_type\": file.content_type,\n \"content_length\": len(content)\n })\n return {\"uploaded_files\": uploaded_files_info}\n\nif __name__ == \"__main__\":\n import uvicorn\n uvicorn.run(app, host=\"0.0.0.0\", port=8080)\n\n```\n\n**Request:**\n```\nimport requests\nurl = \"[URL]\n\nfiles=[\n ('images',('a.jpeg',open('\/home\/ash\/Pictures\/a.jpeg','rb'),'image\/jpeg')),\n ('images',('b.jpeg',open('\/home\/ash\/Pictures\/b.jpeg','rb'),'image\/jpeg'))\n]\n\nresponse = requests.post(url, files=files)\nresponse.text\n```\n**Response:**\n```\n'{\"uploaded_files\":[{\"filename\":\"a.jpeg\",\"content_type\":\"image\/jpeg\",\"content_length\":8155},{\"filename\":\"b.jpeg\",\"content_type\":\"image\/jpeg\",\"content_length\":7104}]}'\n```","> I believe the bug is on the client side.\n\nI believe you mean server side.\n\n> \n> The request seems to be sent correctly (although [URL] only shows one file being received).\n> After creating my own endpoint using fastapi, I was able to see both files I uploaded.\n> \n> **Server:**\n> ```\n> from fastapi import FastAPI, File, UploadFile\n> from typing import List\n> \n> app = FastAPI()\n> \n> @[USER].post(\"\/upload\")\n> async def upload_files(images: List[UploadFile]):\n> uploaded_files_info = []\n> for file in images:\n> content = await file.read()\n> uploaded_files_info.append({\n> \"filename\": file.filename,\n> \"content_type\": file.content_type,\n> \"content_length\": len(content)\n> })\n> return {\"uploaded_files\": uploaded_files_info}\n> \n> if __name__ == \"__main__\":\n> import uvicorn\n> uvicorn.run(app, host=\"0.0.0.0\", port=8080)\n> \n> ```\n> \n> **Request:**\n> ```\n> import requests\n> url = \"[URL]\n> \n> files=[\n> ('images',('a.jpeg',open('\/home\/ash\/Pictures\/a.jpeg','rb'),'image\/jpeg')),\n> ('images',('b.jpeg',open('\/home\/ash\/Pictures\/b.jpeg','rb'),'image\/jpeg'))\n> ]\n> \n> response = requests.post(url, files=files)\n> response.text\n> ```\n> **Response:**\n> ```\n> '{\"uploaded_files\":[{\"filename\":\"a.jpeg\",\"content_type\":\"image\/jpeg\",\"content_length\":8155},{\"filename\":\"b.jpeg\",\"content_type\":\"image\/jpeg\",\"content_length\":7104}]}'\n> ```\n> \n> \n\nAs a result I'm going to close this"],"state":"closed","state_reason":"not_planned","is_closed":true,"created_at":"2024-02-24T08:02:15Z","closed_at":"2024-04-05T22:58:46Z","updated_at":"2025-04-06T00:04:46Z","days_to_close":41.62,"created_year_month":"2024-02","labels":[],"issue_type":"other","comments_reported":4,"n_comments_collected":4,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":171.29,"reactions_total":0,"author_id":"user_0442","author_association":"NONE","comment_author_ids":["user_0255","user_0028","user_0256","user_0028"],"comment_author_roles":["NONE","CONTRIBUTOR","NONE","CONTRIBUTOR"],"comment_by_issue_author":[false,false,false,false],"has_code_block":true,"has_traceback":false,"title_words":11,"body_words":127,"locked":true}
{"number":6650,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6650","title":"Max retries exceeded with url","body_clean":"Can explain me cause of this error and is possible avoid or solve it ?\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"\/mnt\/PIDrive\/Recordurbate\/recordurbate\/bot.py\", line 81, in is_online\n r = requests.get(url)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/api.py\", line 73, in get\n return request(\"get\", url, params=params, **kwargs)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/api.py\", line 59, in request\n return session.request(method=method, url=url, **kwargs)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/sessions.py\", line 589, in request\n resp = self.send(prep, **send_kwargs)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/sessions.py\", line 703, in send\n r = adapter.send(request, **kwargs)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/adapters.py\", line 517, in send\n raise SSLError(e, request=request)\nrequests.exceptions.SSLError: HTTPSConnectionPool(host='chaturbate.com', port=443): Max retries exceeded with url: \/api\/public\/affiliates\/onlinerooms\/?wm=DkfRj&client_ip=request_ip&limit=500 (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))","body_prose":"Can explain me cause of this error and is possible avoid or solve it ?\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"\/mnt\/PIDrive\/Recordurbate\/recordurbate\/bot.py\", line 81, in is_online\n r = requests.get(url)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/api.py\", line 73, in get\n return request(\"get\", url, params=params, **kwargs)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/api.py\", line 59, in request\n return session.request(method=method, url=url, **kwargs)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/sessions.py\", line 589, in request\n resp = self.send(prep, **send_kwargs)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/sessions.py\", line 703, in send\n r = adapter.send(request, **kwargs)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/adapters.py\", line 517, in send\n raise SSLError(e, request=request)\nrequests.exceptions.SSLError: HTTPSConnectionPool(host='chaturbate.com', port=443): Max retries exceeded with url: \/api\/public\/affiliates\/onlinerooms\/?wm=DkfRj&client_ip=request_ip&limit=500 (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))","text":"Max retries exceeded with url. Can explain me cause of this error and is possible avoid or solve it ?\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"\/mnt\/PIDrive\/Recordurbate\/recordurbate\/bot.py\", line 81, in is_online\n r = requests.get(url)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/api.py\", line 73, in get\n return request(\"get\", url, params=params, **kwargs)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/api.py\", line 59, in request\n return session.request(method=method, url=url, **kwargs)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/sessions.py\", line 589, in request\n resp = self.send(prep, **send_kwargs)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/sessions.py\", line 703, in send\n r = adapter.send(request, **kwargs)\n File \"\/usr\/local\/lib\/python3.9\/dist-packages\/requests\/adapters.py\", line 517, in send\n raise SSLError(e, request=request)\nrequests.exceptions.SSLError: HTTPSConnectionPool(host='chaturbate.com', port=443): Max retries exceeded with url: \/api\/public\/affiliates\/onlinerooms\/?wm=DkfRj&client_ip=request_ip&limit=500 (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))","comments":["As described in the template, we won't be able to answer questions on this issue tracker. Please use [Stack Overflow]([URL]"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-02-25T02:11:56Z","closed_at":"2024-02-25T02:12:07Z","updated_at":"2024-02-25T02:12:08Z","days_to_close":0.0,"created_year_month":"2024-02","labels":["Question\/Not a bug","actions\/autoclose-qa"],"issue_type":"question","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":0.0,"reactions_total":0,"author_id":"user_0441","author_association":"NONE","comment_author_ids":["user_0023"],"comment_author_roles":["NONE"],"comment_by_issue_author":[false],"has_code_block":false,"has_traceback":true,"title_words":5,"body_words":107,"locked":true}
{"number":6653,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6653","title":"Document which exceptions request() might raise","body_clean":"Ask to document which exceptions request() might raise\n\nI notice that the .[json function documents that it might raise]([URL] a `JSONDecodeError`. This is very helpful for writing comprehensive error handling code around requests. I'm asking for that to be done for [the main interface]([URL] as well.\n\nWhile [a list of exceptions]([URL] is provided in the documentation, it is not clear which exceptions will be returned by which methods. For example I don't think `JSONDecodeError` can be raised by `.get`. I tried to read the requests code to get a sense of which might be thrown from it, but it is a little challenging to follow as a first time reader.","body_prose":"Ask to document which exceptions request() might raise\n\nI notice that the .[json function documents that it might raise]([URL] a `JSONDecodeError`. This is very helpful for writing comprehensive error handling code around requests. I'm asking for that to be done for [the main interface]([URL] as well.\n\nWhile [a list of exceptions]([URL] is provided in the documentation, it is not clear which exceptions will be returned by which methods. For example I don't think `JSONDecodeError` can be raised by `.get`. I tried to read the requests code to get a sense of which might be thrown from it, but it is a little challenging to follow as a first time reader.","text":"Document which exceptions request() might raise. Ask to document which exceptions request() might raise\n\nI notice that the .[json function documents that it might raise]([URL] a `JSONDecodeError`. This is very helpful for writing comprehensive error handling code around requests. I'm asking for that to be done for [the main interface]([URL] as well.\n\nWhile [a list of exceptions]([URL] is provided in the documentation, it is not clear which exceptions will be returned by which methods. For example I don't think `JSONDecodeError` can be raised by `.get`. I tried to read the requests code to get a sense of which might be thrown from it, but it is a little challenging to follow as a first time reader.","comments":["As a newcomer to this project, I'm eager to contribute and address the mentioned issue. I'd like to inquire about the exceptions list mentioned in the documentation—is it exhaustive and does it encompass all possible exceptions? If so, I'm prepared to work on enhancing the documentation. My proposal is to not only update the main interface but also extend the coverage to other methods, aiming for consistency similar to what is currently done for the .json() function.","That would lead to a lot of code duplication in my opinion, apart from `requests.ReadTimeout` and `requests.JSONDecodeError` , all [request methods return an instance of the `Response` object]([URL] which can raise the [same exceptions]([URL]","I want to solve this issue @[USER] , if this issue is still opened and kindly assign me this issue and provide me necessary required information","can i get assigned to solve this issue?","Olá! Vi que esta issue ainda está aberta e é algo que eu próprio gostaria de ver documentado. Posso tentar compilar uma lista das exceções lançadas pelo request() para adicionarmos à documentação?\"","Olá a todos!\nContinuei a investigar esta issue e fiz um mapeamento exaustivo dos raise em todo o código-fonte do requests para entender onde cada exceção do requests.exceptions é disparada.\nCom base nesta análise, identifiquei grupos lógicos de falhas que seriam valiosos para os utilizadores:\nRede\/Conexão: (ConnectTimeout, ReadTimeout, ConnectionError, ProxyError, SSLError).\nURL\/Protocolo: (InvalidURL, MissingSchema, InvalidSchema).\nDados: (JSONDecodeError, HTTPError).\nAcredito que a melhor forma de resolver esta questão é criar uma 'Exception Reference' na documentação, agrupando estas exceções por categoria, em vez de apenas listar exceções por método.\nGostaria de propor esta estrutura e começar a redigir um rascunho desta secção. O que pensam desta abordagem? Posso seguir em frente com a proposta?\""],"state":"open","state_reason":null,"is_closed":false,"created_at":"2024-02-27T23:09:53Z","closed_at":null,"updated_at":"2026-06-13T21:59:33Z","days_to_close":null,"created_year_month":"2024-02","labels":[],"issue_type":"bug","comments_reported":6,"n_comments_collected":6,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":179.88,"reactions_total":0,"author_id":"user_0440","author_association":"NONE","comment_author_ids":["user_0250","user_0251","user_0252","user_0253","user_0254","user_0254"],"comment_author_roles":["NONE","NONE","NONE","NONE","NONE","NONE"],"comment_by_issue_author":[false,false,false,false,false,false],"has_code_block":false,"has_traceback":false,"title_words":6,"body_words":110,"locked":false}
{"number":6656,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6656","title":"The content for this response was already consumed","body_clean":"I am using response.iter_content(chunk_size=None)) to read stream data also kept stream = True, here i am trying to read set of jsons in a loop, but if something breaks due to network issue (which i observed it does removes some characters) and its not complete json i kept except condition to read from response.text for which I am getting an error -->The content for this response was already consumed \n\n## Expected Result\n\nit should read set of json as a stream data in a loop using response.iter_content(chunk_size=None)) and if it breaks or missing something than it should read complete data from response.text in except condition\n\n## Actual Result\n\ni get the error--> The content for this response was already consumed \n\nI am using requests version is '2.31.0'\n\n```python\nimport requests\n\n```\n\n## System Information\n\nCell In[15], line 56\n 53 if json_error==True:\n 54 print('--------')\n---> 56 print(response.text)\n 57 print('--------')\n 58 print('\\n')\n\nFile ~\\AppData\\Local\\anaconda3\\Lib\\site-packages\\requests\\models.py:923, in Response.text(self)\n 920 content = None\n 921 encoding = self.encoding\n--> 923 if not self.content:\n 924 return \"\"\n 926 # Fallback to auto-detected encoding.\n\nFile ~\\AppData\\Local\\anaconda3\\Lib\\site-packages\\requests\\models.py:894, in Response.content(self)\n 891 if self._content is False:\n 892 # Read the contents.\n 893 if self._content_consumed:\n--> 894 raise RuntimeError(\"The content for this response was already consumed\")\n 896 if self.status_code == 0 or self.raw is None:\n 897 self._content = None\n\nRuntimeError: The content for this response was already consumed","body_prose":"I am using response.iter_content(chunk_size=None)) to read stream data also kept stream = True, here i am trying to read set of jsons in a loop, but if something breaks due to network issue (which i observed it does removes some characters) and its not complete json i kept except condition to read from response.text for which I am getting an error -->The content for this response was already consumed \n\n## Expected Result\n\nit should read set of json as a stream data in a loop using response.iter_content(chunk_size=None)) and if it breaks or missing something than it should read complete data from response.text in except condition\n\n## Actual Result\n\ni get the error--> The content for this response was already consumed \n\nI am using requests version is '2.31.0'\n\n [CODE] \n\n## System Information\n\nCell In[15], line 56\n 53 if json_error==True:\n 54 print('--------')\n---> 56 print(response.text)\n 57 print('--------')\n 58 print('\\n')\n\nFile ~\\AppData\\Local\\anaconda3\\Lib\\site-packages\\requests\\models.py:923, in Response.text(self)\n 920 content = None\n 921 encoding = self.encoding\n--> 923 if not self.content:\n 924 return \"\"\n 926 # Fallback to auto-detected encoding.\n\nFile ~\\AppData\\Local\\anaconda3\\Lib\\site-packages\\requests\\models.py:894, in Response.content(self)\n 891 if self._content is False:\n 892 # Read the contents.\n 893 if self._content_consumed:\n--> 894 raise RuntimeError(\"The content for this response was already consumed\")\n 896 if self.status_code == 0 or self.raw is None:\n 897 self._content = None\n\nRuntimeError: The content for this response was already consumed","text":"The content for this response was already consumed. I am using response.iter_content(chunk_size=None)) to read stream data also kept stream = True, here i am trying to read set of jsons in a loop, but if something breaks due to network issue (which i observed it does removes some characters) and its not complete json i kept except condition to read from response.text for which I am getting an error -->The content for this response was already consumed \n\n## Expected Result\n\nit should read set of json as a stream data in a loop using response.iter_content(chunk_size=None)) and if it breaks or missing something than it should read complete data from response.text in except condition\n\n## Actual Result\n\ni get the error--> The content for this response was already consumed \n\nI am using requests version is '2.31.0'\n\n [CODE] \n\n## System Information\n\nCell In[15], line 56\n 53 if json_error==True:\n 54 print('--------')\n---> 56 print(response.text)\n 57 print('--------')\n 58 print('\\n')\n\nFile ~\\AppData\\Local\\anaconda3\\Lib\\site-packages\\requests\\models.py:923, in Response.text(self)\n 920 content = None\n 921 encoding = self.encoding\n--> 923 if not self.content:\n 924 return \"\"\n 926 # Fallback to auto-detected encoding.\n\nFile ~\\AppData\\Local\\anaconda3\\Lib\\site-packages\\requests\\models.py:894, in Response.content(self)\n 891 if self._content is False:\n 892 # Read the contents.\n 893 if self._content_consumed:\n--> 894 raise RuntimeError(\"The content for this response was already consumed\")\n 896 if self.status_code == 0 or self.raw is None:\n 897 self._content = None\n\nRuntimeError: The content for this response was already consumed","comments":["this is very urgent for me","can library owner can respond?","Hello Alnisha,\nI am willing to work on your issue. could you please give me Reproduction Steps so that I understand your issue clearly ? \n Best Regards","Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use [StackOverflow]([URL] for general usage questions instead and only report defects here. There is no urgent unpaid support. Demanding someone help you urgently is not acceptable behavior"],"state":"closed","state_reason":"not_planned","is_closed":true,"created_at":"2024-03-04T11:41:15Z","closed_at":"2024-03-06T10:57:27Z","updated_at":"2025-03-07T00:04:37Z","days_to_close":1.97,"created_year_month":"2024-03","labels":[],"issue_type":"other","comments_reported":4,"n_comments_collected":4,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":46.51,"reactions_total":0,"author_id":"user_0249","author_association":"NONE","comment_author_ids":["user_0249","user_0249","user_0250","user_0028"],"comment_author_roles":["NONE","NONE","NONE","CONTRIBUTOR"],"comment_by_issue_author":[true,true,false,false],"has_code_block":true,"has_traceback":false,"title_words":8,"body_words":223,"locked":true}
{"number":6657,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6657","title":"Post Request Status and header error.","body_clean":"I am currently involved in a project where it is necessary to send POST requests to a remote server. I have noticed unexpected behavior when trying to emulate a POST request that I receive from Mozilla Firefox.\n\nSpecifically, when I perform the POST request through Mozilla Firefox, I receive a response with HTTP\/0.9 without headers and a reported status of 200. However, when I try to emulate the same POST request in Python 3 using the requests library, I do not receive any status code, and I encounter an error \"raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine('\\n'))\".\n\nAfter a more in-depth analysis, I discovered that the server is responding with HTTP\/0.9, which may be the cause of the problem. However, I am unable to obtain a valid status code using requests.\n\nTo temporarily resolve the issue, I modified the behavior of the _read_status(self) function in the requests library to convert the first line into a valid status code. I also simulated the presence of the line \"line = b'\\r\\n'\" in the header to avoid issues when reading the headers.\n\nHow can I correctly interpret the response from the server? My request header is as follows:\n\nHere is the code:\n`\nimport requests\n\nuid = \"3491282510\"\nurl = f'[URL]\nprint(url)\n\nheaders = {\n \"User-Agent\": \"Mozilla\/5.0\",\n \"Accept\": \"application\/xhtml+xml\",\n \"Accept-Language\": \"en-US,en;q=0.5\",\n \"Accept-Encoding\": \"gzip, deflate, bz\"\n}\n\ndata = {\n 'fd0': '0\/2',\n 'fd1': 'Port 2',\n 'fd2': '0\/2',\n 'fd3': '1000X',\n 'fd4': 'Disabled',\n 'fd5': 'On',\n 'fd6': '1G',\n 'fd7': 'Full',\n 'fd8': 'Off',\n 'fd9': 'Off',\n 'fd10': 'On',\n 'fd11': 'Do nothing',\n 'fd12': 'N\/A',\n 'fd13': '5',\n 'choice': 'Apply'\n}\n\nresponse = requests.post(url, headers=headers, data=data, verify=False)\nprint(response.status_code)\n# Output the response content\nprint(response.text)\n`\nHow i can solve this issue?\nty","body_prose":"I am currently involved in a project where it is necessary to send POST requests to a remote server. I have noticed unexpected behavior when trying to emulate a POST request that I receive from Mozilla Firefox.\n\nSpecifically, when I perform the POST request through Mozilla Firefox, I receive a response with HTTP\/0.9 without headers and a reported status of 200. However, when I try to emulate the same POST request in Python 3 using the requests library, I do not receive any status code, and I encounter an error \"raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine('\\n'))\".\n\nAfter a more in-depth analysis, I discovered that the server is responding with HTTP\/0.9, which may be the cause of the problem. However, I am unable to obtain a valid status code using requests.\n\nTo temporarily resolve the issue, I modified the behavior of the _read_status(self) function in the requests library to convert the first line into a valid status code. I also simulated the presence of the line \"line = b'\\r\\n'\" in the header to avoid issues when reading the headers.\n\nHow can I correctly interpret the response from the server? My request header is as follows:\n\nHere is the code:\n`\nimport requests\n\nuid = \"3491282510\"\nurl = f'[URL]\nprint(url)\n\nheaders = {\n \"User-Agent\": \"Mozilla\/5.0\",\n \"Accept\": \"application\/xhtml+xml\",\n \"Accept-Language\": \"en-US,en;q=0.5\",\n \"Accept-Encoding\": \"gzip, deflate, bz\"\n}\n\ndata = {\n 'fd0': '0\/2',\n 'fd1': 'Port 2',\n 'fd2': '0\/2',\n 'fd3': '1000X',\n 'fd4': 'Disabled',\n 'fd5': 'On',\n 'fd6': '1G',\n 'fd7': 'Full',\n 'fd8': 'Off',\n 'fd9': 'Off',\n 'fd10': 'On',\n 'fd11': 'Do nothing',\n 'fd12': 'N\/A',\n 'fd13': '5',\n 'choice': 'Apply'\n}\n\nresponse = requests.post(url, headers=headers, data=data, verify=False)\nprint(response.status_code)\n# Output the response content\nprint(response.text)\n`\nHow i can solve this issue?\nty","text":"Post Request Status and header error.. I am currently involved in a project where it is necessary to send POST requests to a remote server. I have noticed unexpected behavior when trying to emulate a POST request that I receive from Mozilla Firefox.\n\nSpecifically, when I perform the POST request through Mozilla Firefox, I receive a response with HTTP\/0.9 without headers and a reported status of 200. However, when I try to emulate the same POST request in Python 3 using the requests library, I do not receive any status code, and I encounter an error \"raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine('\\n'))\".\n\nAfter a more in-depth analysis, I discovered that the server is responding with HTTP\/0.9, which may be the cause of the problem. However, I am unable to obtain a valid status code using requests.\n\nTo temporarily resolve the issue, I modified the behavior of the _read_status(self) function in the requests library to convert the first line into a valid status code. I also simulated the presence of the line \"line = b'\\r\\n'\" in the header to avoid issues when reading the headers.\n\nHow can I correctly interpret the response from the server? My request header is as follows:\n\nHere is the code:\n`\nimport requests\n\nuid = \"3491282510\"\nurl = f'[URL]\nprint(url)\n\nheaders = {\n \"User-Agent\": \"Mozilla\/5.0\",\n \"Accept\": \"application\/xhtml+xml\",\n \"Accept-Language\": \"en-US,en;q=0.5\",\n \"Accept-Encoding\": \"gzip, deflate, bz\"\n}\n\ndata = {\n 'fd0': '0\/2',\n 'fd1': 'Port 2',\n 'fd2': '0\/2',\n 'fd3': '1000X',\n 'fd4': 'Disabled',\n 'fd5': 'On',\n 'fd6': '1G',\n 'fd7': 'Full',\n 'fd8': 'Off',\n 'fd9': 'Off',\n 'fd10': 'On',\n 'fd11': 'Do nothing',\n 'fd12': 'N\/A',\n 'fd13': '5',\n 'choice': 'Apply'\n}\n\nresponse = requests.post(url, headers=headers, data=data, verify=False)\nprint(response.status_code)\n# Output the response content\nprint(response.text)\n`\nHow i can solve this issue?\nty","comments":["As described in the template, we won't be able to answer questions on this issue tracker. Please use [Stack Overflow]([URL]"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-03-06T13:02:35Z","closed_at":"2024-03-06T13:02:47Z","updated_at":"2024-03-06T13:02:48Z","days_to_close":0.0,"created_year_month":"2024-03","labels":["Question\/Not a bug","actions\/autoclose-qa"],"issue_type":"question","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":0.0,"reactions_total":0,"author_id":"user_0439","author_association":"NONE","comment_author_ids":["user_0023"],"comment_author_roles":["NONE"],"comment_by_issue_author":[false],"has_code_block":false,"has_traceback":false,"title_words":6,"body_words":280,"locked":true}
{"number":6658,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6658","title":"Post requests with unicode chars in string as data sends incomplete\/trimmed data (in >=2.30 with urllib3 2.0)","body_clean":"In the *requests*>=2.30.0 (with urllib3 2+), when you send a post request with `data=`, the server receives incomplete\/trimmed data. This is due to the fact `content-length` set by *requests* will not match the actually sent data. It is set to len(data), yet it sends data.encoded() - which is longer.\n\nIf *requests* uses urllib3 1.x versions this throws an exception, for example:\n\nUnicodeEncodeError: 'latin-1' codec can't encode character '\\u0159' in position 10: Body ('ř') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.\n\n## Expected Result\n\nEither:\na) send complete data (where content-length header == len(data.encode()), not len(data) )\nb) raise an exception as urlllib3 1.x versions did, suggesting the str should be utf-8 encoded\nc) raise an exception telling the user he is not supposed to pass strings to the `data` argument\n\n## Actual Result\n\nNo error is reported on the client side, nor is the data sent correctly. Server reads incomplete data.\n\n## Reproduction Steps\n\n```python\nimport requests\nd=\"Lidová tvořivost na sebe nenechala dlouho čekat.\"\nrequests.post('[URL] data=d)\n```\n\nServer receives `Lidová tvořivost na sebe nenechala dlouho ček` in the requests body, which is incomplete\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"2.0.12\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.6\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.11.8\"\n },\n \"platform\": {\n \"release\": \"22.6.0\",\n \"system\": \"Darwin\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"300000d0\"\n },\n \"urllib3\": {\n \"version\": \"2.2.1\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}\n```","body_prose":"In the *requests*>=2.30.0 (with urllib3 2+), when you send a post request with `data=`, the server receives incomplete\/trimmed data. This is due to the fact `content-length` set by *requests* will not match the actually sent data. It is set to len(data), yet it sends data.encoded() - which is longer.\n\nIf *requests* uses urllib3 1.x versions this throws an exception, for example:\n\nUnicodeEncodeError: 'latin-1' codec can't encode character '\\u0159' in position 10: Body ('ř') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.\n\n## Expected Result\n\nEither:\na) send complete data (where content-length header == len(data.encode()), not len(data) )\nb) raise an exception as urlllib3 1.x versions did, suggesting the str should be utf-8 encoded\nc) raise an exception telling the user he is not supposed to pass strings to the `data` argument\n\n## Actual Result\n\nNo error is reported on the client side, nor is the data sent correctly. Server reads incomplete data.\n\n## Reproduction Steps\n\n [CODE] \n\nServer receives `Lidová tvořivost na sebe nenechala dlouho ček` in the requests body, which is incomplete\n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"Post requests with unicode chars in string as data sends incomplete\/trimmed data (in >=2.30 with urllib3 2.0). In the *requests*>=2.30.0 (with urllib3 2+), when you send a post request with `data=`, the server receives incomplete\/trimmed data. This is due to the fact `content-length` set by *requests* will not match the actually sent data. It is set to len(data), yet it sends data.encoded() - which is longer.\n\nIf *requests* uses urllib3 1.x versions this throws an exception, for example:\n\nUnicodeEncodeError: 'latin-1' codec can't encode character '\\u0159' in position 10: Body ('ř') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.\n\n## Expected Result\n\nEither:\na) send complete data (where content-length header == len(data.encode()), not len(data) )\nb) raise an exception as urlllib3 1.x versions did, suggesting the str should be utf-8 encoded\nc) raise an exception telling the user he is not supposed to pass strings to the `data` argument\n\n## Actual Result\n\nNo error is reported on the client side, nor is the data sent correctly. Server reads incomplete data.\n\n## Reproduction Steps\n\n [CODE] \n\nServer receives `Lidová tvořivost na sebe nenechala dlouho ček` in the requests body, which is incomplete\n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["Hi @[USER], this is a duplicate of #6586 which is already fixed in #6589. Please check opened and closed issues before opening new ones. Thanks!"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-03-07T19:11:48Z","closed_at":"2024-03-07T19:15:20Z","updated_at":"2025-03-08T00:03:48Z","days_to_close":0.0,"created_year_month":"2024-03","labels":[],"issue_type":"feature_request","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":true,"hours_to_first_response":0.06,"reactions_total":0,"author_id":"user_0438","author_association":"NONE","comment_author_ids":["user_0007"],"comment_author_roles":["MEMBER"],"comment_by_issue_author":[false],"has_code_block":true,"has_traceback":false,"title_words":17,"body_words":191,"locked":true}
{"number":6660,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6660","title":"REQUESTS_CA_BUNDLE and CURL_CA_BUNDLE environment variables get ignored when in a venv","body_clean":"Requests supports the REQUESTS_CA_BUNDLE and CURL_CA_BUNDLE environment variables to override the certificate \n\n## Expected Result\n \nHere's what's happening outside of the venv\n```\nREQUESTS_CA_BUNDLE=\/etc\/ssl\/certs\/ca-certificates.crt python3\nPython 3.11.8 (main, Feb 08 2024, 08:03:16) [GCC] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import certifi\n>>> certifi.where()\n'\/etc\/ssl\/certs\/ca-certificates.crt'\n```\n## Actual Result\n \nInside the venv:\n```\nfried@linux:\/tmp> python3 -m venv .venv\nfried@linux:\/tmp> source .venv\/bin\/activate\n(.venv) fried@linux:\/tmp> pip install requests\nCollecting requests\n Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)\nCollecting charset-normalizer<4,>=2 (from requests)\n Downloading charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (33 kB)\nCollecting idna<4,>=2.5 (from requests)\n Downloading idna-3.6-py3-none-any.whl.metadata (9.9 kB)\nCollecting urllib3<3,>=1.21.1 (from requests)\n Downloading urllib3-2.2.1-py3-none-any.whl.metadata (6.4 kB)\nCollecting certifi>=2017.4.17 (from requests)\n Downloading certifi-2024.2.2-py3-none-any.whl.metadata (2.2 kB)\nDownloading requests-2.31.0-py3-none-any.whl (62 kB)\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6\/62.6 kB 3.4 MB\/s eta 0:00:00\nDownloading certifi-2024.2.2-py3-none-any.whl (163 kB)\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 163.8\/163.8 kB 5.3 MB\/s eta 0:00:00\nDownloading charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (140 kB)\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.3\/140.3 kB 10.9 MB\/s eta 0:00:00\nDownloading idna-3.6-py3-none-any.whl (61 kB)\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.6\/61.6 kB 5.7 MB\/s eta 0:00:00\nDownloading urllib3-2.2.1-py3-none-any.whl (121 kB)\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.1\/121.1 kB 10.1 MB\/s eta 0:00:00\nInstalling collected packages: urllib3, idna, charset-normalizer, certifi, requests\nSuccessfully installed certifi-2024.2.2 charset-normalizer-3.3.2 idna-3.6 requests-2.31.0 urllib3-2.2.1\n\n(.venv) fried@linux:\/tmp> REQUESTS_CA_BUNDLE=\/etc\/ssl\/certs\/ca-certificates.crt python3\nPython 3.11.8 (main, Feb 08 2024, 08:03:16) [GCC] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import certifi\n>>> certifi.where()\n'\/tmp\/.venv\/lib64\/python3.11\/site-packages\/certifi\/cacert.pem'\n>>> \n```\n\n## Reproduction Steps\n\n```bash\n$ python3 -m venv .venv\n$ source .venv\/bin\/activate\n$ REQUESTS_CA_BUNDLE=\/etc\/ssl\/certs\/ca-certificates.crt python\n>>> import certifi\n>>> certifi.where()\n```\n\n## System Information\n\n $ python -m requests.help\n\n```json\n{\n \"chardet\": {\n \"version\": null\n },\n \"charset_normalizer\": {\n \"version\": \"3.3.2\"\n },\n \"cryptography\": {\n \"version\": \"\"\n },\n \"idna\": {\n \"version\": \"3.6\"\n },\n \"implementation\": {\n \"name\": \"CPython\",\n \"version\": \"3.11.8\"\n },\n \"platform\": {\n \"release\": \"6.7.7-1-default\",\n \"system\": \"Linux\"\n },\n \"pyOpenSSL\": {\n \"openssl_version\": \"\",\n \"version\": null\n },\n \"requests\": {\n \"version\": \"2.31.0\"\n },\n \"system_ssl\": {\n \"version\": \"30100040\"\n },\n \"urllib3\": {\n \"version\": \"2.2.1\"\n },\n \"using_charset_normalizer\": true,\n \"using_pyopenssl\": false\n}\n```","body_prose":"Requests supports the REQUESTS_CA_BUNDLE and CURL_CA_BUNDLE environment variables to override the certificate \n\n## Expected Result\n \nHere's what's happening outside of the venv\n [CODE] \n## Actual Result\n \nInside the venv:\n [CODE] \n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","text":"REQUESTS_CA_BUNDLE and CURL_CA_BUNDLE environment variables get ignored when in a venv. Requests supports the REQUESTS_CA_BUNDLE and CURL_CA_BUNDLE environment variables to override the certificate \n\n## Expected Result\n \nHere's what's happening outside of the venv\n [CODE] \n## Actual Result\n \nInside the venv:\n [CODE] \n\n## Reproduction Steps\n\n [CODE] \n\n## System Information\n\n $ python -m requests.help\n\n [CODE]","comments":["A few things:\n\n1. Requests isn't in use in your examples; you're using `certifi`. \n2. My guess, is that outside of the venv you have `certifi` from your package manager, and every Linux distro replaces `certifi` with something else\n3. `certifi` (a separate project) does not support either environment variable, Requests does.\n4. Requests will continue to honor what you set, except in cases like #3829 \n5. Lastly, I think this is effectively a duplicate of #6565","Duplicate of #6565"],"state":"closed","state_reason":"completed","is_closed":true,"created_at":"2024-03-13T16:03:02Z","closed_at":"2024-03-13T18:51:46Z","updated_at":"2025-03-14T00:04:36Z","days_to_close":0.12,"created_year_month":"2024-03","labels":[],"issue_type":"feature_request","comments_reported":2,"n_comments_collected":2,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":2.81,"reactions_total":0,"author_id":"user_0437","author_association":"NONE","comment_author_ids":["user_0028","user_0028"],"comment_author_roles":["CONTRIBUTOR","CONTRIBUTOR"],"comment_by_issue_author":[false,false],"has_code_block":true,"has_traceback":false,"title_words":11,"body_words":42,"locked":true}
{"number":6663,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6663","title":"How to download multiple files in local system using POST API request in python rather than in ascii or binary form data ?","body_clean":"I struck in one scenario in which i need to download multiple files in local repository using POST API request in python 3.9.12.\n\nI tried below code but not able to resolve the issue.\n\n```\ndef download(url: str, dest_folder: str):\n if not os.path.exists(dest_folder):\n os.makedirs(dest_folder)\n\n filename = url.split('\/')[-1].replace(\" \", \"_\")\n file_path = os.path.join(dest_folder, filename)\n\n payload = {'testcaseId': '305432601'}\n\n r = requests.post(url, data=json.dumps(payload), stream=False)\n if r.ok:\n print(\"saving to\", os.path.abspath(file_path))\n with open(file_path, 'wb') as f:\n for chunk in r.iter_content(chunk_size=1024 * 8):\n if chunk:\n f.write(chunk)\n f.flush()\n os.fsync(f.fileno())\n else: # HTTP status code 4XX\/5XX\n print(\"Download failed: status code {}\\n{}\".format(r.status_code, r.text))\n\ndownload(\"[URL] dest_folder=\"\/\/PycharmProjects\/\/Testing_Local\/\/Logs\")\n\n```\nWhen I used above code it gives me below error:\n\n```\nDownload failed: status code 500\n{\"timestamp\":\"2024-03-14T11:45:42.109+00:00\",\"status\":500,\"error\":\"Internal Server Error\",\"path\":\"\/siteapi\/resultfiles\/\"}\n```\n\n**In postman we have that option to SEND and DOWNLOAD files and through that i am able to download multiple files in zip folder in my local system.**\n\n. Are there any plans start to accept new features? Can contributors help with anything?\n\nLack of new features leads to introducing new HTTP clients like [niquests]([URL] which do support HTTP\/2, QUICK, DNS over HTTPS and so on.","body_prose":"Hi.\n\nFor several years I see feature freeze on this project (although I haven't see any announce about it). Are there any plans start to accept new features? Can contributors help with anything?\n\nLack of new features leads to introducing new HTTP clients like [niquests]([URL] which do support HTTP\/2, QUICK, DNS over HTTPS and so on.","text":"Is feature freeze permanent?. Hi.\n\nFor several years I see feature freeze on this project (although I haven't see any announce about it). Are there any plans start to accept new features? Can contributors help with anything?\n\nLack of new features leads to introducing new HTTP clients like [niquests]([URL] which do support HTTP\/2, QUICK, DNS over HTTPS and so on.","comments":["Yes it is. There's an issue describing the feature freeze policy.","Duplicate #969"],"state":"closed","state_reason":"not_planned","is_closed":true,"created_at":"2024-03-18T09:35:24Z","closed_at":"2024-03-18T10:26:46Z","updated_at":"2024-03-18T10:26:57Z","days_to_close":0.04,"created_year_month":"2024-03","labels":[],"issue_type":"feature_request","comments_reported":2,"n_comments_collected":2,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":0.82,"reactions_total":1,"author_id":"user_0435","author_association":"NONE","comment_author_ids":["user_0028","user_0028"],"comment_author_roles":["CONTRIBUTOR","CONTRIBUTOR"],"comment_by_issue_author":[false,false],"has_code_block":false,"has_traceback":false,"title_words":4,"body_words":56,"locked":true}
{"number":6666,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6666","title":"Consider making certifi an optional dependency","body_clean":"1. In some cases users may need to access some site in a company private network, with SSL certificate signed by custom root certificate (not public). Accessing this site using browser is working fine if user added this root certificate to system cert store. But requests will complain that certificate cannot be verified, and user have to pass this root certificate to `session.verify = '\/path\/to\/cert.pem\"` or by passing the same path to `REQUESTS_CA_BUNDLE` env variable. IMHO, this is redundant step which introduces more headache than solves anything.\n2. `certifi` has MPL 2.0 license which _may be_ considered as copyleft, and prohibited to use by legals. Not all of users know that MPL 2.0 license is file-based, and license actually cannot \"spread\" to packages which depend on it.\n\nIs is possible to introduce `pip install requests[certifi]` for installing certifi explicitly, and remove if from default installation?","body_prose":"1. In some cases users may need to access some site in a company private network, with SSL certificate signed by custom root certificate (not public). Accessing this site using browser is working fine if user added this root certificate to system cert store. But requests will complain that certificate cannot be verified, and user have to pass this root certificate to `session.verify = '\/path\/to\/cert.pem\"` or by passing the same path to `REQUESTS_CA_BUNDLE` env variable. IMHO, this is redundant step which introduces more headache than solves anything.\n2. `certifi` has MPL 2.0 license which _may be_ considered as copyleft, and prohibited to use by legals. Not all of users know that MPL 2.0 license is file-based, and license actually cannot \"spread\" to packages which depend on it.\n\nIs is possible to introduce `pip install requests[certifi]` for installing certifi explicitly, and remove if from default installation?","text":"Consider making certifi an optional dependency. 1. In some cases users may need to access some site in a company private network, with SSL certificate signed by custom root certificate (not public). Accessing this site using browser is working fine if user added this root certificate to system cert store. But requests will complain that certificate cannot be verified, and user have to pass this root certificate to `session.verify = '\/path\/to\/cert.pem\"` or by passing the same path to `REQUESTS_CA_BUNDLE` env variable. IMHO, this is redundant step which introduces more headache than solves anything.\n2. `certifi` has MPL 2.0 license which _may be_ considered as copyleft, and prohibited to use by legals. Not all of users know that MPL 2.0 license is file-based, and license actually cannot \"spread\" to packages which depend on it.\n\nIs is possible to introduce `pip install requests[certifi]` for installing certifi explicitly, and remove if from default installation?","comments":["No"],"state":"closed","state_reason":"not_planned","is_closed":true,"created_at":"2024-03-18T09:47:47Z","closed_at":"2024-03-18T10:25:21Z","updated_at":"2024-03-18T10:25:23Z","days_to_close":0.03,"created_year_month":"2024-03","labels":[],"issue_type":"feature_request","comments_reported":1,"n_comments_collected":1,"comments_complete":true,"maintainer_replied":false,"hours_to_first_response":0.62,"reactions_total":0,"author_id":"user_0435","author_association":"NONE","comment_author_ids":["user_0028"],"comment_author_roles":["CONTRIBUTOR"],"comment_by_issue_author":[false],"has_code_block":false,"has_traceback":false,"title_words":6,"body_words":145,"locked":true}
{"number":6669,"html_url":"https:\/\/github.com\/psf\/requests\/issues\/6669","title":"Failed to ignore the SSL certificate verification when using `verify=False` option","body_clean":"Requests is not ignoring the SSL certificate verification when using the `verify=False` option.\n\n## Expected Result\n\nSame as curl with `-k`\n\n```bash\n$ curl -k [URL]\n\n301 Moved Permanently<\/title><\/head>\n\n