Forums

problems in proxy settings

i am trying to set my own proxy:

x=requests.get('https://ipinfo.io/ip')
print(x.text)
34.224*****


socks.set_default_proxy(socks.SOCKS5, '45.125.66.1**', 3***)
socket.socket = socks.socksocket

after this line code dose not emplements :

print(1)
x=requests.get('https://ipinfo.io/ip')
print(x.text)

please tell me how to set up my proxies ?

[edit by admin: formatting]

What kind of proxy is it? If it's an HTTP(S) proxy, I'd recommend using the requests module's built-in proxy support rather than the low-level socks module.

@giles its sock5 . i am not using request , i ma using seleniuam ,and another libiries , i need to set up proxy

Hmm. Selenium might be tricky; you'll need to configure the Firefox browser that it starts up to use SOCKS5. This Stack Overflow post might help with that.

For the other libraries, the answer is also likely to be library-dependent.

is there any way to set my proxy by default like this : socks.set_default_proxy(socks.SOCKS5, '45.125.66.1', 3*) ?

See the requests documentation linked above for that.