Search code examples
python-requestshttp-proxypraw

updating PRAW requests HTTPS Proxy


I know you can specify a proxy via requests in praw using the environmental variable. I have had success doing so.

However, when building a custom session and specifying the the proxy address like so:

    s = Session()
    proxies =  { 'https': 'https://72.35.40.34:8080'}
    s.proxies.update(proxies)
    # praw.ini holds praw_bot_name oauth details
    bot = praw.Reddit(praw_bot_name, requestor_kwargs={'session': s})
    print(bot._core._requestor._http.proxies)

The proxy will not take. The correct address shows up in this print statement, but via wireshark, I can see that the proxy is not actually in effect.

Does anyone know what might be going on here?


Solution

  • okay - so the above should actually work. I had a mistake elsewhere in my code which was causing my requests to run through my readonly reddit instance (which I was not defining a proxy for).

    Will consider removing this question if others think it is not very useful.