DEV Community


Posted on - Building a rotating proxy API

Creating another proxy service

There are a lot of services out there that provide proxies in many different ways. Some provide them in bulk, others provide them via an API, others just provide them for free on their website. The problem is that many of these services serve dead or sluggish proxies making it very difficult to use without having to verify that they are working yourself.

For a few projects I have planned, I need an API that would provide working proxies every time I requested them. I needed a service that was extremely aggressive about checking its proxies so that no proxy that was dead would last in the pool long enough to be served.

From this Proxy Orbit was born.

Proxy Orbit is a service that aims to do one set of tasks very well:

Scan the web for open proxies, save them, check them constantly, return a random proxy when an API request is made, and allow for filtering of the results.

Basic API Usage

A basic API request currently looks something like this:

Which returns an object that looks like the following

    anonymous: true,
    cookies: true,
    curl: "",
    get: true,
    ip: "",
    isp: "No.31,Jin-rong Street",
    lastChecked: 1564551731.418154,
    location: "CN",
    port: 8118,
    post: true,
    protocol: "http",
    rtt: 1.008148431777954,
    ssl: false,
    websites: {
       amazon: false,
       facebook: false,
       google: false,
       instagram: false,
       netflix: false,
       nike: false,
       shopify: false,
       stubhub: false,
       supreme: false,
       ticketmaster: false,
       twitch: false,
       twitter: false,
       youtube: false

All proxies returned have been checked within the last hour.

Proxies can also be returned in bulk using the count query argument.

The above will return five proxy objects in a JSON array.

Proxies can also be filtered by all parameters in the object. For example

will return HTTP proxies that can load and support HTTPS.

Examples in Python and NodeJS

Since everything is provided over a basic REST API, integration into existing code should be trivial. Here are two examples of using Proxy Orbit in Python and NodeJS. The scripts request a new proxy and check the proxy's IP.

Python Code

import requests

resp = requests.get("")
if resp.status_code != 200:
    raise Exception("Token Expired!")

json = resp.json()
curl = json['curl']

resp2 = requests.get("", proxies={"https":curl, "http":curl})
print("Proxy IP is:", resp2.content)


const request = require("request");

request.get("", (err, resp, body) => {
    if(err) {
    } else if(resp.statusCode != 200) {
        console.log("Token has expired");
    } else {
        json = JSON.parse(body);
        }, (err, resp, body) => {
            console.log("Proxy IP is:", body);

Checking pool quality

To test the quality of the pool I have been using the following script

import requests

total = 100
failed = 0
url = input("URL: ")
for x in range(total):
    resp = requests.get("").json()
    curl = resp['curl']
        r = requests.get(url, proxies={"http":curl, "https":curl}, timeout=10)
    except Exception as e:
        print(curl, "failed")
        failed += 1
        if r.status_code != 200:
            failed += 1

error_rate = (failed / total) * 100

print(f"{error_rate}% failed")

The script makes 100 requests to a specific URL and tracks the number of failures. It then takes the # failures / 100 * 100 to calculate the error percentage. So far my tests to have shown roughly 3% of the proxies failing (3 / 100 do not work). Though isn't very strict about blocking proxy IPs.

Proxies are bound to fail because they are open. Others are using them as well and they get banned much quicker than private proxy servers. Though it is difficult to attain 100% working proxies in the pool at any given time, the proxy checking algorithm ensures that broken proxies are removed as soon as they are noticed to be dead. This is normally within minutes of the proxy no longer working.


Proxy Orbit will be used as a foundation for a couple of other products that are currently in the works. It's definitely been a lot of fun creating this one and I hope that some other people could find use in it as well.

As for the tech stack Proxy Orbit uses Python 3, Flask, and MongoDB.

If you are interested you can check the site out at If you aren't interested in paying for the service, we do provide 2000 API requests per month for free when you sign up.

Feedback is always greatly appreciated!


Top comments (3)

mattkocaj profile image
matt kocaj

This is so kool and so useful.

fprime profile image

So glad you think so! Thanks! :)

mattkocaj profile image
matt kocaj • Edited

number of paying customers or indiehackers profile?