In most cases, you have sent a request using the proxy to connect client server. because you do not have direct access to connect those servers. Or they can accept only the requests of their country.
First, we need to import Requests library. Requests is an elegant and simple HTTP library for Python.
If you want proxy server ip address and port numbers, you can follow this link proxies
First, we need to import Requests library. Requests is an elegant and simple HTTP library for Python.
import requests
proxies = {
"https": "171.255.192.118:8080",
"http" : "171.255.192.118:8080"
}
#Check your present IP address
url = "http://httpbin.org/ip"
ip = requests.get(url)
r = ip.json()
print (r)
#Connect Proxy server
ip = requests.get(url, proxies=proxies)
r = ip.json()
print (r)
#OUTPUT
{'origin': '125.62.194.242'}
{'origin': '171.255.192.118'}
Comments
Post a Comment
Thank you :)