I have been searching all over the place for this, but I couldn't solve my issue.
I am using a local API to fetch some data, in that API, the wildcard is the percent character
The URL is like so :
urlReq = 'http://myApiURL?ID=something¶meter=%w42'
And then I'm passing this to the get function:
req = requests.get(urlReq,auth=HTTPBasicAuth(user, pass))
And get the following error:
InvalidURL: Invalid percent-escape sequence: 'w4'
I have tried escaping the
% character using
%%, but in vain. I also tried the following:
urlReq = 'http://myApiURL?ID=something¶meter=%sw42' % '%' but didn't work as well.
Does anyone know how to solve this?
PS I'm using Python 2.7.8 :: Anaconda 1.9.1 (64-bit)