Proxies for Open Government Data Collection
Collecting data from open government portals requires proxies that can handle rate limits and bulk downloads while respecting the public service's resources. RotatingProxy provides the IP rotation and geographic targeting needed to build reliable, polite data pipelines for public sector information.
- Choose rotating residential proxies for portals that block datacenter IPs, available in 177 countries.
- Use rotating datacenter proxies for high-volume bulk downloads of large datasets and files.
- Set sticky sessions with a session ID to maintain a single IP for multi-step data queries.
- Schedule crawls during off-peak hours to reduce load on public infrastructure and avoid blocks.
What do proxies for open government data collection need?
Proxies for open government data collection must handle three core tasks: navigating rate-limited portals, downloading large bulk files, and maintaining polite, sustainable access patterns. Public sector websites often implement per-IP rate limits to manage server load, even for openly published data. Your proxy network needs to rotate IPs to distribute requests and avoid hitting these limits, while also providing the option for a stable IP when conducting a multi-step query or download session. Geographic targeting is frequently necessary because data is often organized by jurisdiction, such as state or city. The solution must be cost-effective for projects that may involve terabytes of historical data, which is why a pay-as-you-go model that charges only for traffic used is ideal. Finally, the setup should be simple, allowing your team to focus on data analysis rather than proxy infrastructure.
Which proxy network is best for government data portals?
The best proxy network depends on the specific portal's security and the type of data access. Many official data portals use basic IP reputation checks and may restrict traffic from known datacenter IP ranges. For these, rotating residential proxies are the most reliable choice as they appear as regular household internet connections. For portals that serve massive CSV, JSON, or PDF files with less restrictive blocking, rotating datacenter proxies offer the highest performance and lowest cost per gigabyte for bulk transfers.
| Network | When it fits | Entry rate per GB |
|---|---|---|
| Rotating Residential | Portals that block datacenters; accessing data by US state or city; general browsing of rate-limited APIs. | $1.79 |
| Rotating Datacenter | High-volume downloads of large public datasets (GIS files, bulk records); portals with no IP filtering. | $0.36 |
| Rotating ISP | A balance of residential trust and datacenter speed for consistent, high-volume polling of updated data. | $1.80 |
| Rotating Mobile | Less common for this use case; useful only if testing mobile-specific views of government apps or sites. | $3.00 |
Check the detailed comparison in our guide residential vs datacenter proxies. Most projects will use a mix: residential for discovery and API calls, and datacenter for the actual bulk file retrieval. You can manage this easily by creating separate proxy users for each network.
How to set the username for geographic targeting
You target a specific country, US state, or city by adding options to your proxy username. This is crucial for accessing data that is geographically segmented, like county health statistics or state transportation data. The username is your proxy login, an underscore, then options like net.res and cc.us joined by underscores. Use the proxy URL builder in your dashboard to generate these strings correctly.
To collect federal data from a US portal that blocks datacenter IPs:
USERNAME_net.res_cc.us
To get building permit data specifically from the city of Chicago:
USERNAME_net.res_cc.us_city.chicago
To maintain a single IP for a 30-minute session while querying a state's API (useful for multi-step searches):
USERNAME_net.res_cc.us_st.ca_sid.abc123_ttl.30
Learn more about all available options in the username options documentation.
How much traffic does public data collection use?
Traffic usage varies wildly, from a few megabytes for API metadata to hundreds of gigabytes for satellite imagery or decades of census records. It's important to estimate and monitor usage. Traffic is metered as upload plus download through our gateway, calculated in gigabytes (1,000,000,000 bytes). The cost automatically decreases as your monthly usage on a network increases, thanks to volume pricing tiers.
Example: Your project downloads 300 GB of open weather sensor data in a month using rotating datacenter proxies. The first 50 GB cost $0.36 per GB. The next 200 GB (50 to 250 GB) cost a lower rate. The final 50 GB (250 to 300 GB) cost an even lower rate. Your total cost is calculated automatically. If you continued to over 1,000 GB in the month, the rate would drop to $0.27 per GB for all traffic beyond that point. There is no need to pre-purchase a plan; you simply top up your balance with a minimum of $40 and pay for what you use.
Code example for Python data collection
Here is a practical Python example using the requests library to download a dataset through a rotating residential proxy, with a polite delay and error handling. This pattern is suitable for most public APIs and file downloads.
import requests
import time
from requests.auth import HTTPProxyAuth
proxy_host = "gw.rotatingproxy.cc"
proxy_port = 7070 # Use 7071 for SOCKS5
username = "USERNAME_net.res_cc.us"
password = "PASSWORD"
proxies = {
"http": f"http://{username}:{password}@{proxy_host}:{proxy_port}",
"https": f"http://{username}:{password}@{proxy_host}:{proxy_port}"
}
# Target URL (example: a public dataset endpoint)
dataset_url = "https://data.gov.au/api/3/action/package_show?id=national-address-register-gnaf"
try:
response = requests.get(dataset_url, proxies=proxies, timeout=30)
response.raise_for_status()
data = response.json()
# Process the metadata to find resource download links...
print("Successfully fetched dataset metadata")
time.sleep(2) # Polite delay between requests
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")
For more complex scraping involving JavaScript, consider using Playwright with Python. For high-concurrency crawling, review our concurrency planning guide.
Good practice: scheduling and politeness
The golden rule for collecting public data is to minimize your impact on the source servers. Always start by checking the portal's robots.txt file (e.g., https://data.gov/robots.txt) and respect any Crawl-delay directives. Schedule your bulk downloads for off-peak hours, such as late evening or early morning in the portal's local timezone. Implement a random delay between requests (e.g., 3 to 10 seconds) to avoid appearing as a denial-of-service attack. Use conditional requests: store Last-Modified headers or ETags, and send If-Modified-Since headers on subsequent runs to skip re-downloading unchanged files, saving bandwidth and cost. Organize your project to cache all downloaded raw data locally before processing; never re-fetch the same data from the portal during analysis. This approach is not only polite but also aligns with legal and ethical web scraping principles.
Common problems and fixes
Problem: The portal returns a 403 Forbidden error even with residential proxies.
Fix: This may indicate your request pattern is too aggressive. Increase delays between requests. Ensure your User-Agent string is realistic and not blocked. Try using a sticky session to appear as a single, persistent user rather than many different IPs in quick succession. Also, verify you are not violating any explicit terms of service.
Problem: Downloads are very slow or time out.
Fix: Large file downloads may hit our default gateway timeout. For multi-gigabyte downloads, consider breaking the request into ranged chunks. Alternatively, switch to the rotating datacenter network for higher throughput on bulk transfers. Check your own network connection and consider if the source server itself may be slow. Our timeouts guide has more troubleshooting steps.
Problem: My usage seems higher than the file sizes I downloaded.
Fix: Remember that traffic is metered for both upload and download through the proxy. HTTP headers, SSL/TLS overhead, and request bodies all count. Enable gzip compression in your requests (Accept-Encoding: gzip) to reduce response sizes. Use our traffic calculator and the traffic measurement guide to understand your consumption.
Using sessions for multi-step queries
Many government data portals require you to search, filter, and then export data, a multi-step process that often relies on session cookies. If you rotate IPs between each step, the session will break. The solution is to use a sticky session. By adding a sid. (session ID) and ttl. (time-to-live in minutes) to your username, you instruct the gateway to keep your connections on the same exit IP for that period. For example, USERNAME_net.res_cc.us_sid.myquery_ttl.15 ensures a 15-minute session. This is essential for workflows that mimic a human using a web interface. More details are in the guide on sticky vs rotating sessions.
Integrating with data pipelines and APIs
For automated data pipelines, you can manage proxies programmatically using our REST API. Generate an API key in your dashboard to create proxy users, check balance, and fetch usage reports. This allows you to dynamically adjust your proxy configuration based on the data source. For example, you could have one pipeline for real estate data from assessor portals using residential proxies, and another for financial regulatory filings using datacenter proxies. The API can help you stay within monthly GB caps set on proxy users.
Respecting terms and focusing on public data
It is your responsibility to use proxies lawfully. Our service is designed for accessing publicly available information. Do not attempt to bypass login systems to access non-public personal data, overwhelm servers, or engage in any activity that violates the Computer Fraud and Abuse Act or similar laws. Focus on data that is meant for public use, such as budgets, legislation, environmental readings, and published reports. This not only keeps you compliant but also supports the mission of open government. For related use cases, see how proxies are used for academic research and data journalism.
Questions
Can I use these proxies to scrape data from a state government website that has a CAPTCHA?
RotatingProxy is a proxy service, not a CAPTCHA solving service. If a public portal places a CAPTCHA, it is often an indication they wish to limit automated access. You should respect that barrier and look for an official API or bulk data download option instead, which many government sites provide.
How do I choose between city targeting and US state targeting?
Use US state targeting (<code>st.</code>) when you need an IP from a specific state but the city doesn't matter. Use city targeting (<code>city.</code>) when you need a more precise location, often for hyper-local data portals. City targeting is available for major cities; check the locations page for the list.
What happens if the city I need is not on your list?
If your required city is not listed, you cannot target it directly. Your best option is to target the country or, if in the US, the state. The IP you receive will still be from that broader region, which is often sufficient for accessing regional data portals.
I need to download 5 TB of historical climate data. Is that allowed?
Yes, high-volume downloads are allowed as long as you are accessing public data and not violating the target site's terms. Use rotating datacenter proxies for the best performance and cost efficiency at that scale. Monitor your balance and top up as needed.
Can I use the same proxy setup for monitoring multiple different government portals?
Yes, you can use a single proxy user for multiple portals, but for better organization and cost tracking, consider creating separate proxy users for each major data source or project. This also lets you set individual monthly GB caps.
The portal I'm accessing seems to block requests after exactly 100 requests from my IP. How should I configure rotation?
This is a clear rate limit. Do not use a sticky session. Omit the <code>sid</code> option from your username so that each connection gets a new IP. Space your requests out with delays and consider using a pool of several different proxy usernames (with different target locations) to further distribute the load.
Start with one top-up, use any network
Create an account in a minute, add $40 or more, and the same balance pays for residential, mobile, datacenter and ISP traffic.