Error when sending a HTTPS post request using Python's requests library with a proxy










5















I've been getting a very strange error when sending HTTPS post requests, I've found a few similar reports, but I haven't found a solution yet. If you have any suggestions, they would be greatly appreciated!



Traceback (most recent call last):
File "C:/Data/Python Projects/Experement.py", line 14, in send_request
return requests.post(URL + '/verify', proxies=proxy).json()
File "C:Python27libsite-packagesrequestsapi.py", line 88, in post
return request('post', url, data=data, **kwargs)
File "C:Python27libsite-packagesrequestsapi.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
File "C:Python27libsite-packagesrequestssessions.py", line 456, in request
resp = self.send(prep, **send_kwargs)
File "C:Python27libsite-packagesrequestssessions.py", line 559, in send
r = adapter.send(request, **kwargs)
File "C:Python27libsite-packagesrequestsadapters.py", line 327, in send
timeout=timeout
File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 488, in urlopen
conn = self._get_conn(timeout=pool_timeout)
File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 222, in _get_conn
return conn or self._new_conn()
File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 683, in _new_conn
return self._prepare_conn(conn)
File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 647, in _prepare_conn
conn.connect()
File "C:Python27libsite-packagesrequestspackagesurllib3connection.py", line 179, in connect
self._tunnel()
File "c:Python27Libhttplib.py", line 759, in _tunnel
line = response.fp.readline(_MAXLINE + 1)
TypeError: readline() takes exactly 1 argument (2 given)









share|improve this question


























    5















    I've been getting a very strange error when sending HTTPS post requests, I've found a few similar reports, but I haven't found a solution yet. If you have any suggestions, they would be greatly appreciated!



    Traceback (most recent call last):
    File "C:/Data/Python Projects/Experement.py", line 14, in send_request
    return requests.post(URL + '/verify', proxies=proxy).json()
    File "C:Python27libsite-packagesrequestsapi.py", line 88, in post
    return request('post', url, data=data, **kwargs)
    File "C:Python27libsite-packagesrequestsapi.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
    File "C:Python27libsite-packagesrequestssessions.py", line 456, in request
    resp = self.send(prep, **send_kwargs)
    File "C:Python27libsite-packagesrequestssessions.py", line 559, in send
    r = adapter.send(request, **kwargs)
    File "C:Python27libsite-packagesrequestsadapters.py", line 327, in send
    timeout=timeout
    File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 488, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
    File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 222, in _get_conn
    return conn or self._new_conn()
    File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 683, in _new_conn
    return self._prepare_conn(conn)
    File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 647, in _prepare_conn
    conn.connect()
    File "C:Python27libsite-packagesrequestspackagesurllib3connection.py", line 179, in connect
    self._tunnel()
    File "c:Python27Libhttplib.py", line 759, in _tunnel
    line = response.fp.readline(_MAXLINE + 1)
    TypeError: readline() takes exactly 1 argument (2 given)









    share|improve this question
























      5












      5








      5








      I've been getting a very strange error when sending HTTPS post requests, I've found a few similar reports, but I haven't found a solution yet. If you have any suggestions, they would be greatly appreciated!



      Traceback (most recent call last):
      File "C:/Data/Python Projects/Experement.py", line 14, in send_request
      return requests.post(URL + '/verify', proxies=proxy).json()
      File "C:Python27libsite-packagesrequestsapi.py", line 88, in post
      return request('post', url, data=data, **kwargs)
      File "C:Python27libsite-packagesrequestsapi.py", line 44, in request
      return session.request(method=method, url=url, **kwargs)
      File "C:Python27libsite-packagesrequestssessions.py", line 456, in request
      resp = self.send(prep, **send_kwargs)
      File "C:Python27libsite-packagesrequestssessions.py", line 559, in send
      r = adapter.send(request, **kwargs)
      File "C:Python27libsite-packagesrequestsadapters.py", line 327, in send
      timeout=timeout
      File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 488, in urlopen
      conn = self._get_conn(timeout=pool_timeout)
      File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 222, in _get_conn
      return conn or self._new_conn()
      File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 683, in _new_conn
      return self._prepare_conn(conn)
      File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 647, in _prepare_conn
      conn.connect()
      File "C:Python27libsite-packagesrequestspackagesurllib3connection.py", line 179, in connect
      self._tunnel()
      File "c:Python27Libhttplib.py", line 759, in _tunnel
      line = response.fp.readline(_MAXLINE + 1)
      TypeError: readline() takes exactly 1 argument (2 given)









      share|improve this question














      I've been getting a very strange error when sending HTTPS post requests, I've found a few similar reports, but I haven't found a solution yet. If you have any suggestions, they would be greatly appreciated!



      Traceback (most recent call last):
      File "C:/Data/Python Projects/Experement.py", line 14, in send_request
      return requests.post(URL + '/verify', proxies=proxy).json()
      File "C:Python27libsite-packagesrequestsapi.py", line 88, in post
      return request('post', url, data=data, **kwargs)
      File "C:Python27libsite-packagesrequestsapi.py", line 44, in request
      return session.request(method=method, url=url, **kwargs)
      File "C:Python27libsite-packagesrequestssessions.py", line 456, in request
      resp = self.send(prep, **send_kwargs)
      File "C:Python27libsite-packagesrequestssessions.py", line 559, in send
      r = adapter.send(request, **kwargs)
      File "C:Python27libsite-packagesrequestsadapters.py", line 327, in send
      timeout=timeout
      File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 488, in urlopen
      conn = self._get_conn(timeout=pool_timeout)
      File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 222, in _get_conn
      return conn or self._new_conn()
      File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 683, in _new_conn
      return self._prepare_conn(conn)
      File "C:Python27libsite-packagesrequestspackagesurllib3connectionpool.py", line 647, in _prepare_conn
      conn.connect()
      File "C:Python27libsite-packagesrequestspackagesurllib3connection.py", line 179, in connect
      self._tunnel()
      File "c:Python27Libhttplib.py", line 759, in _tunnel
      line = response.fp.readline(_MAXLINE + 1)
      TypeError: readline() takes exactly 1 argument (2 given)






      python python-requests






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jun 30 '14 at 1:52









      EchocageEchocage

      135313




      135313






















          2 Answers
          2






          active

          oldest

          votes


















          2














          This seems to be an open bug in httplib: http://bugs.python.org/issue17849. There's a short patch attached to the issue, so you could just apply that to your copy of httplib.py.



          I had a quick look through the commit histories of connection.py in urllib3 and Requests' copy of urllib3, but it didn't seem like any workaround had been applied.






          share|improve this answer






























            1














            As you can see in here:



            line = response.fp.readline(_MAXLINE + 1)
            TypeError: readline() takes exactly 1 argument (2 given)


            the request's function readline does not accepts arguments other than 'self'. So it's indeed a library bug.



            At the end of this discussion: https://github.com/requests/requests/issues/2159, suggests that could be a missconfigured proxy who triggers the bug, also that bug was fixed on python 2.7 as you can see here: https://bugs.python.org/issue17849



            Maybe you can consider upgrade to python3, and requests library as well.






            share|improve this answer






















              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24482023%2ferror-when-sending-a-https-post-request-using-pythons-requests-library-with-a-p%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              This seems to be an open bug in httplib: http://bugs.python.org/issue17849. There's a short patch attached to the issue, so you could just apply that to your copy of httplib.py.



              I had a quick look through the commit histories of connection.py in urllib3 and Requests' copy of urllib3, but it didn't seem like any workaround had been applied.






              share|improve this answer



























                2














                This seems to be an open bug in httplib: http://bugs.python.org/issue17849. There's a short patch attached to the issue, so you could just apply that to your copy of httplib.py.



                I had a quick look through the commit histories of connection.py in urllib3 and Requests' copy of urllib3, but it didn't seem like any workaround had been applied.






                share|improve this answer

























                  2












                  2








                  2







                  This seems to be an open bug in httplib: http://bugs.python.org/issue17849. There's a short patch attached to the issue, so you could just apply that to your copy of httplib.py.



                  I had a quick look through the commit histories of connection.py in urllib3 and Requests' copy of urllib3, but it didn't seem like any workaround had been applied.






                  share|improve this answer













                  This seems to be an open bug in httplib: http://bugs.python.org/issue17849. There's a short patch attached to the issue, so you could just apply that to your copy of httplib.py.



                  I had a quick look through the commit histories of connection.py in urllib3 and Requests' copy of urllib3, but it didn't seem like any workaround had been applied.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 30 '14 at 2:16









                  freshtopfreshtop

                  567615




                  567615























                      1














                      As you can see in here:



                      line = response.fp.readline(_MAXLINE + 1)
                      TypeError: readline() takes exactly 1 argument (2 given)


                      the request's function readline does not accepts arguments other than 'self'. So it's indeed a library bug.



                      At the end of this discussion: https://github.com/requests/requests/issues/2159, suggests that could be a missconfigured proxy who triggers the bug, also that bug was fixed on python 2.7 as you can see here: https://bugs.python.org/issue17849



                      Maybe you can consider upgrade to python3, and requests library as well.






                      share|improve this answer



























                        1














                        As you can see in here:



                        line = response.fp.readline(_MAXLINE + 1)
                        TypeError: readline() takes exactly 1 argument (2 given)


                        the request's function readline does not accepts arguments other than 'self'. So it's indeed a library bug.



                        At the end of this discussion: https://github.com/requests/requests/issues/2159, suggests that could be a missconfigured proxy who triggers the bug, also that bug was fixed on python 2.7 as you can see here: https://bugs.python.org/issue17849



                        Maybe you can consider upgrade to python3, and requests library as well.






                        share|improve this answer

























                          1












                          1








                          1







                          As you can see in here:



                          line = response.fp.readline(_MAXLINE + 1)
                          TypeError: readline() takes exactly 1 argument (2 given)


                          the request's function readline does not accepts arguments other than 'self'. So it's indeed a library bug.



                          At the end of this discussion: https://github.com/requests/requests/issues/2159, suggests that could be a missconfigured proxy who triggers the bug, also that bug was fixed on python 2.7 as you can see here: https://bugs.python.org/issue17849



                          Maybe you can consider upgrade to python3, and requests library as well.






                          share|improve this answer













                          As you can see in here:



                          line = response.fp.readline(_MAXLINE + 1)
                          TypeError: readline() takes exactly 1 argument (2 given)


                          the request's function readline does not accepts arguments other than 'self'. So it's indeed a library bug.



                          At the end of this discussion: https://github.com/requests/requests/issues/2159, suggests that could be a missconfigured proxy who triggers the bug, also that bug was fixed on python 2.7 as you can see here: https://bugs.python.org/issue17849



                          Maybe you can consider upgrade to python3, and requests library as well.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 14 '18 at 18:48









                          Juan Ignacio SánchezJuan Ignacio Sánchez

                          331112




                          331112



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24482023%2ferror-when-sending-a-https-post-request-using-pythons-requests-library-with-a-p%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Kleinkühnau

                              Makov (Slowakei)

                              Deutsches Schauspielhaus