HTTP request made by urllib3 and requests library are different












0















Goal: I am trying to scrape some data off a website.



Problem: I have to use the requests library but it gives me error.



import requests
url = "https://www.random.com"
requests.get(url)


Attempt at solution: I have another program that uses urllib3 to get website data and it works fine:



url = "https://www.random.com"
http = urllib3.PoolManager()
http.request("GET", url)


I discovered that urllib3 and requests uses a common library to send the requests, so I thought I could see what the difference between the two was and maybe change it accordingly. Whilst reading the stack trace below and following it I noticed that requests for some reason can't read the response(the code section is from connectionpool.py of one of the library):



    def begin(self):
if self.headers is not None:
# we've already started reading the response
return

# read until we get a non-100 response
while True:
version, status, reason = self._read_status()


The last line in the above code is where they both differ. requests gets an error and does not get any response. urllib3 gets a response and continues on. My suspicion is that it has to do with the security protocols of requests, but I am lost since there are so many variables it sets before sending the response.



Full stack trace of the first piece of code:



Traceback (most recent call last):
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/path/lib/python3.7/http/client.py", line 1321, in getresponse
response.begin()
File "/path/lib/python3.7/http/client.py", line 296, in begin
version, status, reason = self._read_status()
File "/path/lib/python3.7/http/client.py", line 257, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/path/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/path/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 290, in recv_into
raise SocketError(str(e))
OSError: (104, 'ECONNRESET')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/path/lib/python3.7/site-packages/requests/adapters.py", line 445, in send
timeout=timeout
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/path/lib/python3.7/site-packages/urllib3/util/retry.py", line 367, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/path/lib/python3.7/site-packages/urllib3/packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/homes/ubalgans/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/path/lib/python3.7/http/client.py", line 1321, in getresponse
response.begin()
File "/path/lib/python3.7/http/client.py", line 296, in begin
version, status, reason = self._read_status()
File "/path/lib/python3.7/http/client.py", line 257, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/path/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/path/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 290, in recv_into
raise SocketError(str(e))
urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError("(104, 'ECONNRESET')"))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/path/PycharmProjects/test/reqtest.py", line 8, in <module>
requests.get(url)
File "/path/lib/python3.7/site-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/path/lib/python3.7/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/path/lib/python3.7/site-packages/requests/sessions.py", line 512, in request
resp = self.send(prep, **send_kwargs)
File "/path/lib/python3.7/site-packages/requests/sessions.py", line 622, in send
r = adapter.send(request, **kwargs)
File "/path/lib/python3.7/site-packages/requests/adapters.py", line 495, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', OSError("(104, 'ECONNRESET')"))


EDIT: I enabled logging to see the difference between the two.



requests:



DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): random.com:443


urllib3:



    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): random.com:443
/path/urllib3/connectionpool.py:857: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
DEBUG:urllib3.connectionpool:https://random.com:443 "GET /request HTTP/1.1" 200 15189









share|improve this question

























  • actually, requests code is http.connection_from_url(url).request("GET", url). And i got Failed to establish a new connection both of them when i accessed website

    – kcorlidy
    Nov 22 '18 at 5:23











  • @kcorlidy Could you elaborate on what you mean by that?

    – Unumunkh Balgansuren
    Nov 22 '18 at 6:41











  • Requests build up connection before request as my first comment, and your urllib3 code set up connection while it is ready to request, but it will be same at last(connection is same only differ on building time) . unfortunately i can not access https: //random.com with browser, requests, urllib3. So i can not figure out the reason why you got such error.

    – kcorlidy
    Nov 22 '18 at 9:23













  • I see. I will work on debugging with that point in mind and come back.

    – Unumunkh Balgansuren
    Nov 23 '18 at 3:05
















0















Goal: I am trying to scrape some data off a website.



Problem: I have to use the requests library but it gives me error.



import requests
url = "https://www.random.com"
requests.get(url)


Attempt at solution: I have another program that uses urllib3 to get website data and it works fine:



url = "https://www.random.com"
http = urllib3.PoolManager()
http.request("GET", url)


I discovered that urllib3 and requests uses a common library to send the requests, so I thought I could see what the difference between the two was and maybe change it accordingly. Whilst reading the stack trace below and following it I noticed that requests for some reason can't read the response(the code section is from connectionpool.py of one of the library):



    def begin(self):
if self.headers is not None:
# we've already started reading the response
return

# read until we get a non-100 response
while True:
version, status, reason = self._read_status()


The last line in the above code is where they both differ. requests gets an error and does not get any response. urllib3 gets a response and continues on. My suspicion is that it has to do with the security protocols of requests, but I am lost since there are so many variables it sets before sending the response.



Full stack trace of the first piece of code:



Traceback (most recent call last):
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/path/lib/python3.7/http/client.py", line 1321, in getresponse
response.begin()
File "/path/lib/python3.7/http/client.py", line 296, in begin
version, status, reason = self._read_status()
File "/path/lib/python3.7/http/client.py", line 257, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/path/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/path/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 290, in recv_into
raise SocketError(str(e))
OSError: (104, 'ECONNRESET')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/path/lib/python3.7/site-packages/requests/adapters.py", line 445, in send
timeout=timeout
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/path/lib/python3.7/site-packages/urllib3/util/retry.py", line 367, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/path/lib/python3.7/site-packages/urllib3/packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/homes/ubalgans/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/path/lib/python3.7/http/client.py", line 1321, in getresponse
response.begin()
File "/path/lib/python3.7/http/client.py", line 296, in begin
version, status, reason = self._read_status()
File "/path/lib/python3.7/http/client.py", line 257, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/path/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/path/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 290, in recv_into
raise SocketError(str(e))
urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError("(104, 'ECONNRESET')"))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/path/PycharmProjects/test/reqtest.py", line 8, in <module>
requests.get(url)
File "/path/lib/python3.7/site-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/path/lib/python3.7/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/path/lib/python3.7/site-packages/requests/sessions.py", line 512, in request
resp = self.send(prep, **send_kwargs)
File "/path/lib/python3.7/site-packages/requests/sessions.py", line 622, in send
r = adapter.send(request, **kwargs)
File "/path/lib/python3.7/site-packages/requests/adapters.py", line 495, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', OSError("(104, 'ECONNRESET')"))


EDIT: I enabled logging to see the difference between the two.



requests:



DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): random.com:443


urllib3:



    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): random.com:443
/path/urllib3/connectionpool.py:857: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
DEBUG:urllib3.connectionpool:https://random.com:443 "GET /request HTTP/1.1" 200 15189









share|improve this question

























  • actually, requests code is http.connection_from_url(url).request("GET", url). And i got Failed to establish a new connection both of them when i accessed website

    – kcorlidy
    Nov 22 '18 at 5:23











  • @kcorlidy Could you elaborate on what you mean by that?

    – Unumunkh Balgansuren
    Nov 22 '18 at 6:41











  • Requests build up connection before request as my first comment, and your urllib3 code set up connection while it is ready to request, but it will be same at last(connection is same only differ on building time) . unfortunately i can not access https: //random.com with browser, requests, urllib3. So i can not figure out the reason why you got such error.

    – kcorlidy
    Nov 22 '18 at 9:23













  • I see. I will work on debugging with that point in mind and come back.

    – Unumunkh Balgansuren
    Nov 23 '18 at 3:05














0












0








0








Goal: I am trying to scrape some data off a website.



Problem: I have to use the requests library but it gives me error.



import requests
url = "https://www.random.com"
requests.get(url)


Attempt at solution: I have another program that uses urllib3 to get website data and it works fine:



url = "https://www.random.com"
http = urllib3.PoolManager()
http.request("GET", url)


I discovered that urllib3 and requests uses a common library to send the requests, so I thought I could see what the difference between the two was and maybe change it accordingly. Whilst reading the stack trace below and following it I noticed that requests for some reason can't read the response(the code section is from connectionpool.py of one of the library):



    def begin(self):
if self.headers is not None:
# we've already started reading the response
return

# read until we get a non-100 response
while True:
version, status, reason = self._read_status()


The last line in the above code is where they both differ. requests gets an error and does not get any response. urllib3 gets a response and continues on. My suspicion is that it has to do with the security protocols of requests, but I am lost since there are so many variables it sets before sending the response.



Full stack trace of the first piece of code:



Traceback (most recent call last):
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/path/lib/python3.7/http/client.py", line 1321, in getresponse
response.begin()
File "/path/lib/python3.7/http/client.py", line 296, in begin
version, status, reason = self._read_status()
File "/path/lib/python3.7/http/client.py", line 257, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/path/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/path/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 290, in recv_into
raise SocketError(str(e))
OSError: (104, 'ECONNRESET')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/path/lib/python3.7/site-packages/requests/adapters.py", line 445, in send
timeout=timeout
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/path/lib/python3.7/site-packages/urllib3/util/retry.py", line 367, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/path/lib/python3.7/site-packages/urllib3/packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/homes/ubalgans/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/path/lib/python3.7/http/client.py", line 1321, in getresponse
response.begin()
File "/path/lib/python3.7/http/client.py", line 296, in begin
version, status, reason = self._read_status()
File "/path/lib/python3.7/http/client.py", line 257, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/path/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/path/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 290, in recv_into
raise SocketError(str(e))
urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError("(104, 'ECONNRESET')"))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/path/PycharmProjects/test/reqtest.py", line 8, in <module>
requests.get(url)
File "/path/lib/python3.7/site-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/path/lib/python3.7/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/path/lib/python3.7/site-packages/requests/sessions.py", line 512, in request
resp = self.send(prep, **send_kwargs)
File "/path/lib/python3.7/site-packages/requests/sessions.py", line 622, in send
r = adapter.send(request, **kwargs)
File "/path/lib/python3.7/site-packages/requests/adapters.py", line 495, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', OSError("(104, 'ECONNRESET')"))


EDIT: I enabled logging to see the difference between the two.



requests:



DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): random.com:443


urllib3:



    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): random.com:443
/path/urllib3/connectionpool.py:857: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
DEBUG:urllib3.connectionpool:https://random.com:443 "GET /request HTTP/1.1" 200 15189









share|improve this question
















Goal: I am trying to scrape some data off a website.



Problem: I have to use the requests library but it gives me error.



import requests
url = "https://www.random.com"
requests.get(url)


Attempt at solution: I have another program that uses urllib3 to get website data and it works fine:



url = "https://www.random.com"
http = urllib3.PoolManager()
http.request("GET", url)


I discovered that urllib3 and requests uses a common library to send the requests, so I thought I could see what the difference between the two was and maybe change it accordingly. Whilst reading the stack trace below and following it I noticed that requests for some reason can't read the response(the code section is from connectionpool.py of one of the library):



    def begin(self):
if self.headers is not None:
# we've already started reading the response
return

# read until we get a non-100 response
while True:
version, status, reason = self._read_status()


The last line in the above code is where they both differ. requests gets an error and does not get any response. urllib3 gets a response and continues on. My suspicion is that it has to do with the security protocols of requests, but I am lost since there are so many variables it sets before sending the response.



Full stack trace of the first piece of code:



Traceback (most recent call last):
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/path/lib/python3.7/http/client.py", line 1321, in getresponse
response.begin()
File "/path/lib/python3.7/http/client.py", line 296, in begin
version, status, reason = self._read_status()
File "/path/lib/python3.7/http/client.py", line 257, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/path/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/path/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 290, in recv_into
raise SocketError(str(e))
OSError: (104, 'ECONNRESET')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/path/lib/python3.7/site-packages/requests/adapters.py", line 445, in send
timeout=timeout
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/path/lib/python3.7/site-packages/urllib3/util/retry.py", line 367, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/path/lib/python3.7/site-packages/urllib3/packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/path/lib/python3.7/site-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/homes/ubalgans/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/path/lib/python3.7/http/client.py", line 1321, in getresponse
response.begin()
File "/path/lib/python3.7/http/client.py", line 296, in begin
version, status, reason = self._read_status()
File "/path/lib/python3.7/http/client.py", line 257, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/path/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/path/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 290, in recv_into
raise SocketError(str(e))
urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError("(104, 'ECONNRESET')"))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/path/PycharmProjects/test/reqtest.py", line 8, in <module>
requests.get(url)
File "/path/lib/python3.7/site-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/path/lib/python3.7/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/path/lib/python3.7/site-packages/requests/sessions.py", line 512, in request
resp = self.send(prep, **send_kwargs)
File "/path/lib/python3.7/site-packages/requests/sessions.py", line 622, in send
r = adapter.send(request, **kwargs)
File "/path/lib/python3.7/site-packages/requests/adapters.py", line 495, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', OSError("(104, 'ECONNRESET')"))


EDIT: I enabled logging to see the difference between the two.



requests:



DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): random.com:443


urllib3:



    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): random.com:443
/path/urllib3/connectionpool.py:857: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
DEBUG:urllib3.connectionpool:https://random.com:443 "GET /request HTTP/1.1" 200 15189






python-3.x http https python-requests urllib3






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 23:44







Unumunkh Balgansuren

















asked Nov 21 '18 at 23:29









Unumunkh BalgansurenUnumunkh Balgansuren

133




133













  • actually, requests code is http.connection_from_url(url).request("GET", url). And i got Failed to establish a new connection both of them when i accessed website

    – kcorlidy
    Nov 22 '18 at 5:23











  • @kcorlidy Could you elaborate on what you mean by that?

    – Unumunkh Balgansuren
    Nov 22 '18 at 6:41











  • Requests build up connection before request as my first comment, and your urllib3 code set up connection while it is ready to request, but it will be same at last(connection is same only differ on building time) . unfortunately i can not access https: //random.com with browser, requests, urllib3. So i can not figure out the reason why you got such error.

    – kcorlidy
    Nov 22 '18 at 9:23













  • I see. I will work on debugging with that point in mind and come back.

    – Unumunkh Balgansuren
    Nov 23 '18 at 3:05



















  • actually, requests code is http.connection_from_url(url).request("GET", url). And i got Failed to establish a new connection both of them when i accessed website

    – kcorlidy
    Nov 22 '18 at 5:23











  • @kcorlidy Could you elaborate on what you mean by that?

    – Unumunkh Balgansuren
    Nov 22 '18 at 6:41











  • Requests build up connection before request as my first comment, and your urllib3 code set up connection while it is ready to request, but it will be same at last(connection is same only differ on building time) . unfortunately i can not access https: //random.com with browser, requests, urllib3. So i can not figure out the reason why you got such error.

    – kcorlidy
    Nov 22 '18 at 9:23













  • I see. I will work on debugging with that point in mind and come back.

    – Unumunkh Balgansuren
    Nov 23 '18 at 3:05

















actually, requests code is http.connection_from_url(url).request("GET", url). And i got Failed to establish a new connection both of them when i accessed website

– kcorlidy
Nov 22 '18 at 5:23





actually, requests code is http.connection_from_url(url).request("GET", url). And i got Failed to establish a new connection both of them when i accessed website

– kcorlidy
Nov 22 '18 at 5:23













@kcorlidy Could you elaborate on what you mean by that?

– Unumunkh Balgansuren
Nov 22 '18 at 6:41





@kcorlidy Could you elaborate on what you mean by that?

– Unumunkh Balgansuren
Nov 22 '18 at 6:41













Requests build up connection before request as my first comment, and your urllib3 code set up connection while it is ready to request, but it will be same at last(connection is same only differ on building time) . unfortunately i can not access https: //random.com with browser, requests, urllib3. So i can not figure out the reason why you got such error.

– kcorlidy
Nov 22 '18 at 9:23







Requests build up connection before request as my first comment, and your urllib3 code set up connection while it is ready to request, but it will be same at last(connection is same only differ on building time) . unfortunately i can not access https: //random.com with browser, requests, urllib3. So i can not figure out the reason why you got such error.

– kcorlidy
Nov 22 '18 at 9:23















I see. I will work on debugging with that point in mind and come back.

– Unumunkh Balgansuren
Nov 23 '18 at 3:05





I see. I will work on debugging with that point in mind and come back.

– Unumunkh Balgansuren
Nov 23 '18 at 3:05












0






active

oldest

votes











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%2f53421881%2fhttp-request-made-by-urllib3-and-requests-library-are-different%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















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%2f53421881%2fhttp-request-made-by-urllib3-and-requests-library-are-different%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

Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

A Topological Invariant for $pi_3(U(n))$