Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for proxy and basic authentication #41

Open
stdevCrow opened this issue Mar 24, 2019 · 0 comments
Open

Add support for proxy and basic authentication #41

stdevCrow opened this issue Mar 24, 2019 · 0 comments

Comments

@stdevCrow
Copy link

stdevCrow commented Mar 24, 2019

Feature description
In many educational centers, internet access is managed through a proxy, and it may require authentication.
Add support for proxies in requests, and also authentication (basic-auth at least)

Possible implementation
For testing purposes: Add the following lines after the imports statements:

http_proxy  = "http://user:password@10.8.6.41:3128"
https_proxy = "https://user:password@10.8.6.41:3128"
ftp_proxy   = "ftp://user:password@10.8.6.41:3128"

proxyDict = { 
              "http"  : http_proxy, 
              "https" : https_proxy, 
              "ftp"   : ftp_proxy
            }

Then add the proxies to each request, for example (see the proxies=proxyDict statement):

resource = session.get(url, verify=True, stream=True, headers=headers, proxies=proxyDict)

and

product_page = session.get("https://www.packtpub.com" + product_url[0], verify=True, headers=headers, proxies=proxyDict)

and so on...

Then add an optional command line option to handle this gracefully.

Notes

  1. Sorry my english, it's not my mother tongue.
  2. I don't code on python, so I don't fill that I can contribute, but I clone this repo and made the above modifications (thanks to stackoverflow) and it works as a charm through my authenticated proxy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant