Python requests: URL with percent character
<p>I have been searching all over the place for this, but I couldn't solve my issue.</p>

<p>I am using a local API to fetch some data, in that API, the wildcard is the percent character <code>%</code>.</p>

<p>The URL is like so : <code>urlReq = 'http://myApiURL?ID=something&amp;parameter=%w42'</code></p>

<p>And then I'm passing this to the get function:</p>

<p><code>req = requests.get(urlReq,auth=HTTPBasicAuth(user, pass))</code></p>

<p>And get the following error: <code>InvalidURL: Invalid percent-escape sequence: 'w4'</code></p>

<p>I have tried escaping the <code>%</code> character using <code>%%</code>, but in vain. I also tried the following:</p>

<p><code>urlReq = 'http://myApiURL?ID=something&amp;parameter=%sw42' % '%'</code> but didn't work as well.</p>

<p>Does anyone know how to solve this?</p>

<p>PS I'm using <strong>Python 2.7.8 :: Anaconda 1.9.1 (64-bit)</strong></p>