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

Adding Proxy to Python Library #60

Closed
felixguerrero12 opened this issue Jul 27, 2022 · 3 comments
Closed

Adding Proxy to Python Library #60

felixguerrero12 opened this issue Jul 27, 2022 · 3 comments

Comments

@felixguerrero12
Copy link

How do I add proxy configuration to the ipinfo library? I do see this uses urllib3 which could be integrated using the following variable:
proxy = urllib3.ProxyManager('http://localhost:3128/')

Is there a way to do it in ipinfo without having to manually change the code?

@UmanShahzad
Copy link
Contributor

Yeah it's not a feature we added to the SDKs directly yet. You could follow e.g. https://stackoverflow.com/questions/8287628/proxies-with-python-requests-module though and use environment variables to force the requests library into using it behind the scenes.

@UmanShahzad
Copy link
Contributor

Let me know if that doesn't work and we'll try to look into it.

@felixguerrero12
Copy link
Author

I was able to get this working by doing the following:

create proxy variable:
proxy_vars = {
'http': 'http://un:pw@proxy.com:8080'
'http': 'http://un:pw@proxy.com:8080'
}

Inside the handler:
handler = ipinfo.getHandler(api_token, request_options={'proxies':proxy_vars, 'verify': False})

ip_addr = '1.1.1.1'
details = handler.getDetails(ip_addr)

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

2 participants