
Hands-on teaching you to save the proxy IP into a JSON file
Crawlers know that the proxy IP is like changing clothes - you have to change it often. But every time you manually organize the IP data can be a whole person collapse, today we will use Python whole point of reality, teach everyone how to save the proxy IP information into JSON format, easy to access at any time.
Why do I have to use JSON to store proxy IPs?
For example, the JSON format is like issuing ID cards to proxy IPs, with each field arranged in a clear way. Compared to a messy txt document, managing with JSON can achieve three cool things:
①Clarity of categorization(type of agreement, expiration date, geographic location at a glance)
②Easy to call(Python works directly as a dictionary)
③Automatic update(with timed tasks)
Real-world code to go one
import json
from datetime import datetime
Pretend to get the proxy data from the ipipgo API.
proxy_list = [
{
"ip": "203.12.34.56",
"port": 8080,
"protocol": "socks5",
"expire_time": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
"location": "Tokyo, Japan"
}.
A few more sample data...
]
Save to json
def save_proxies(data).
with open('ipipgo_proxies.json', 'w', encoding='utf-8') as f.
json.dump(data, f, ensure_ascii=False, indent=2)
print("✅ Proxy data has been deposited into the safe")
Call the save function
save_proxies(proxy_list)
Notice the use ofensure_ascii=Falseparameter, otherwise the Chinese address will become garbled. indent=2 so that the json file layout neatly, the gospel of obsessive-compulsive patients.
How do you play with ipipgo's APIs to be more slick?
Here's a godsend for the gang - ipipgo'sDynamic Residential Agents, his home API call is as simple as ordering takeout:
1. Sign up and get your exclusive key
2. Calling the interface to get a fresh IP in seconds
3. Automatic formatting into JSON
Give an example of a real call:
import requests
API_URL = "https://api.ipipgo.com/getproxy"
API_KEY = "Your unique key"
response = requests.get(f"{API_URL}?key={API_KEY}&format=json")
fresh_proxies = response.json()
save_proxies(fresh_proxies)
Common pitfalls QA
Q: What should I do if my saved IP suddenly fails?
A: It is recommended to work with ipipgo'sSmart Refresh PackageTheir IP survival time is half an hour longer than their counterparts, and the Enterprise package has an automatic compensation for failure.
Q: Does storing JSON compromise privacy?
A: Remember to put the json file outside of the project root directory or use encrypted storage. ipipgo client supportLocal encryption hosting, don't even have to save the file yourself.
Q: What if different services require different IPs?
A: Add a business type field to the save, for example:
{
"usage": "e-commerce-crawler",
"ip": "203.55.66.77",
...
}
Package Selection Guide
| Business Type | Recommended Packages | Great tips for saving money |
|---|---|---|
| Individual small projects | Dynamic residential (standard) | Choose a traffic package for better value |
| Enterprise Capture | Dynamic Residential (Business) | Contact customer service for discounts |
| Fixed IP requirements | Static homes | Buy more, get more free. |
One last rant: use ipipgo'sSERP APIYou can directly bypass the pit of data collection, and you don't even have to maintain your own agent pool. Their technicians are still online at two o'clock in the morning to answer questions, this service has no sei!

