Skip to content
Advertisement

Python Requests InvalidURL: Failed to parse URL

thanks you very much. it has a “u200b” follow the .com. “u200b” is an invisable character. the reason is i copy the url from the website.

but something interesting i found: if i use pip install requests==2.21.0(old version), it will not except this err. only use new version it will err.

InvalidURL: Failed to parse URL, some url will except this error while some other url wouldn’t.

already upgrade urllib3 and requests

err

JavaScript

env

JavaScript

code

JavaScript

error log

JavaScript

Advertisement

Answer

There’s a typo, or invalid invisible character in your url. please copy from my code:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement