Created
June 8, 2018 13:13
-
-
Save paveldedik/8a02a3ee0c1578f2eea7ef526bd4104a to your computer and use it in GitHub Desktop.
Minimal example to raise bad write entry error with urllib3 and certifi.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import certifi | |
import urllib3.contrib.pyopenssl | |
from urllib3.connectionpool import connection_from_url | |
urllib3.contrib.pyopenssl.inject_into_urllib3() | |
conn = connection_from_url('https://httpbin.org/post', cert_reqs='CERT_REQUIRED', ca_certs=certifi.where()) | |
conn.urlopen( | |
method='POST', | |
url='https://httpbin.org/post', | |
body=u'c'*401000, | |
headers={'User-Agent': 'python-requests/2.18.4', | |
'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', | |
'Connection': 'keep-alive', 'Content-Length': '401000'}, | |
redirect=False, | |
assert_same_host=False, | |
preload_content=False, | |
decode_content=False, | |
retries=1, | |
timeout=30, # timeout causes bad write entry error | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment