Search...
Menu

How to use Rotating proxy through Python?

Please note before configuration: python needs to be executed in an overseas network environment to make the IPFoxy proxy effective


1. IPFoxy page operation

After purchasing the rotating proxy, enter the【 Rotating Residential 】page and complete the following operations:

1. Protocol type: http

2. Format: Username:Password@Host:Port

3. Generate proxy

4. Copy the generated connection information

article image


2. Operation in python

1. Copy the following code into the python code , and paste the agent connection information just copied in IPFoxy to the code, such as the agent connection information is: IPFoxy:password@gate-us-ipfoxy.io:58688

import urllib.request

if __name__ == '__main__':
    proxy = urllib.request.ProxyHandler({'https': 'IPFoxy:password@gate-us-ipfoxy.io:58688'})
    opener = urllib.request.build_opener(proxy,urllib.request.HTTPHandler)
    urllib.request.install_opener(opener)
    content = urllib.request.urlopen('https://lumtest.com/myip.json').read()
    print(content)

2. Execute the code and you can see from the log that the export IP has changed

article image

Share this Article
Previous
Get residential data history (API)
Next
How to use Rotating proxy through Java?
Last modified: 2024-10-11Powered by