cannot suppress urllib3 warnings
See original GitHub issueLibrary:
- pywinrm==0.3.0
- requests==2.22.0
- urllib3==1.25.3
Issues:
urllib3.exceptions.HeaderParsingError
isn’t suppressed
Python Code:
import logging
import winrm
logging.basicConfig(level=logging.DEBUG)
session = winrm.Session(remote, auth=(username, password), transport="ntlm", server_cert_validation="ignore")
result = session.run_cmd('ipconfig', ['/all'])
logging.info(result.std_out.decode())
Trace:
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): nangs-jw1.eng.citrite.net:5985
DEBUG:urllib3.connectionpool:http://nangs-jw1.eng.citrite.net:5985 "POST /wsman HTTP/1.1" 401 0
DEBUG:urllib3.connectionpool:Resetting dropped connection: nangs-jw1.eng.citrite.net
DEBUG:urllib3.connectionpool:http://nangs-jw1.eng.citrite.net:5985 "POST /wsman HTTP/1.1" 401 0
DEBUG:urllib3.connectionpool:http://nangs-jw1.eng.citrite.net:5985 "POST /wsman HTTP/1.1" 200 0
DEBUG:urllib3.connectionpool:http://nangs-jw1.eng.citrite.net:5985 "POST /wsman HTTP/1.1" 200 1896
WARNING:urllib3.connectionpool:Failed to parse headers (url=http://nangs-jw1.eng.citrite.net:5985/wsman): [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''
Traceback (most recent call last):
File "/home/administrator/.pyenv/versions/3.7.4/lib/python3.7/site-packages/urllib3/connectionpool.py", line 399, in _make_request
assert_header_parsing(httplib_response.msg)
File "/home/administrator/.pyenv/versions/3.7.4/lib/python3.7/site-packages/urllib3/util/response.py", line 72, in assert_header_parsing
raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data)
urllib3.exceptions.HeaderParsingError: [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''
Issue Analytics
- State:
- Created 4 years ago
- Comments:13
Top Results From Across the Web
Unverified HTTPS request is being made in Python2.6 - Stack ...
To disable warnings in requests' vendored urllib3, you'll need to import that ... This will suppress all warnings though, not just InsecureRequest (ie...
Read more >Suppress SSL certificate warnings when ssl_verify=False is set?
I'm using influxdb-python with an InfluxDB instance with a self-signed SSL certificate. I have ssl=True, and ssl_verify=False is on by default (although I ......
Read more >How to disable InsecureRequestWarning: Unverified HTTPS ...
How to disable InsecureRequestWarning: Unverified HTTPS request is being made. If you use requests or urllib3, requests with SSL ...
Read more >unverified https request is being made to host - You.com | The ...
To disable warnings in requests' vendored urllib3, you'll need to import that ... InfluxDB cannot connect From Remote host using Python client Script....
Read more >Advanced Usage - urllib3 1.26.13 documentation
Finally, you can suppress the warnings at the interpreter level by setting the PYTHONWARNINGS environment variable or by using the -W flag. Google...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In urllib3==1.25.11 this issue exists, while in the newest version urllib3==1.26.6 it is fixed for me.
Script used: httplib_response_testing.py
Going through that script(I wanted to be 100% sure), it does look like an issue upstream. Testing the output from an encrypted and non-encrypted server displays the following:
After some debugging, the errors are not really a problem IMO. When
http_client.HTTPResponse
passes on the header only for processing toemail.parser.Parser
here , those errors are generated because it believes it is processing an entire response.The
parsestr
allows to specify that it is headers only, and not attempt to process any body. The definition is hereI think suppressing these errors may be the best course of action for now…