Python Requests Removing __ (Double Underscore) From URL -
i'm using python requests send request. request parameters have variables contain double underscores. example:
example.com/index.php?__action=login&__location=hub
but, when using requests.get()
, checking url used strips off variables contain double underscores. here's example:
jsondata = json.dumps({ 'foo': 'bar' }) params = { 'data': urllib.quote_plus(jsondata), '__action': 'login', '__location': 'hub' } url = 'http://example.com/p/' resp = request.get(url, params=params) print resp.url
the url isn't sending correctly, it's missing params contain double underscores.
any ideas why?
figured out. in fact not showing params in url (thought going mad). problem wasn't obvious though.
resp.url
showing url after page had redirected. redirecting because wasn't using https
, server responded https
requests. typo caused many headaches.
allow_redirects=false
shown me requests
wasn't removing anything.
Comments
Post a Comment