singapore-mobile-proxy
Route Scrapy spiders and Playwright browsers through a dedicated Singapore 4G mobile IP, and rotate it when a site starts blocking you.
- Scrapy downloader middleware: one setting sends every request through the line, and it can rotate the IP on a status code (403, 429, ...), on a schedule, or when you ask for it
- Playwright helpers and examples for Python and Node: launch through the proxy, check the exit IP, rotate
singapore-proxyCLI: print the exit IP and carrier, or rotate and wait for the new IP- Plain
ProxyConfigthat hands the same credentials to requests, httpx, curl or anything else - No dependencies beyond the standard library (Scrapy and Playwright are optional extras)
It is built for Singapore Mobile Proxy lines: one physical 4G modem per port with a Singtel or M1 SIM card, HTTP and SOCKS5, so the sites you scrape see a phone on a Singapore carrier network. The middleware works with any HTTP proxy that has a rotation URL.
Quickstart (Scrapy)
pip install "singapore-mobile-proxy[scrapy]"
export SMP_PROXY="host:port:user:pass" # the HTTP line from your dashboard
export SMP_ROTATE_URL="https://.../rotate/..." # the rotation link from your dashboard
# settings.py
DOWNLOADER_MIDDLEWARES = {"singapore_mobile_proxy.scrapy.SingaporeProxyMiddleware": 740}
SMP_ROTATE_ON_STATUS = [403, 429]
That's it. Check the line is up before a long crawl:
singapore-proxy check
{
"ip": "...",
"country": "SG",
"org": "AS45143 ...",
"asn": "AS45143",
"carrier": "singtel",
"mobile": true
}
No line yet? There is a free 24-hour trial, then from $4 a day, $13 a week or $40 a month.
Rotating the IP
A rotation asks the modem to redial, and the carrier hands it a new IP. Each line allows one rotation every 4 minutes through the rotation link, or every 5 minutes through the API. The middleware knows this: it never rotates twice for one burst of blocked responses, and when the line is still cooling down it passes the response on instead of retrying on the same IP.
| Setting | Default | What it does |
|---|---|---|
SMP_ROTATE_ON_STATUS |
[] |
Rotate and retry the request when the response has one of these codes |
SMP_ROTATE_EVERY |
0 |
Rotate every N seconds (0 = off). Use 240 or more |
SMP_ROTATE_MAX_RETRIES |
2 |
Rotations per request before the blocked response is passed on |
SMP_ROTATE_SETTLE |
5 |
Seconds to wait after a rotation before sending again |
SMP_ROTATE_MIN_INTERVAL |
240 / 300 |
Gap the middleware keeps between rotations (link / API). Only change it if your line has a different limit |
SMP_ENABLED |
True |
Set to False to switch the middleware off |
Every SMP_* setting can also come from an environment variable of the same name, so credentials
stay out of your code. Settings win over the environment.
Rotate by hand from a callback:
def parse(self, response):
if "captcha" in response.text:
yield response.request.replace(
meta={**response.request.meta, "smp_rotate": True}, dont_filter=True)
Skip the proxy for one request with meta={"smp_skip": True}. A request that already has its own
meta["proxy"] is left alone.
The crawl stats show what happened: smp/rotations, smp/retries, smp/rotation_cooldown,
smp/rotation_failed and smp/gave_up.
Using the API instead of the link: set SMP_API_KEY and SMP_LICENSE (the license UUID of the
line) instead of SMP_ROTATE_URL.
Playwright
Chromium can't log in to a SOCKS5 proxy, so browsers use the HTTP port.
from playwright.sync_api import sync_playwright
from singapore_mobile_proxy import ProxyConfig
proxy = ProxyConfig.from_env()
with sync_playwright() as p:
browser = p.chromium.launch(proxy=proxy.playwright())
page = browser.new_page()
page.goto("https://ipinfo.io/json")
print(page.inner_text("body"))
Full examples that check the exit IP, rotate, and confirm the new IP:
- Python:
examples/playwright_rotate.py - Node:
examples/playwright_rotate.mjs(no dependency on this package) - Scrapy spider you can run with
scrapy runspider:examples/scrapy_spider.py
Other clients
from singapore_mobile_proxy import ProxyConfig, Rotator, rotate_and_wait
proxy = ProxyConfig.from_env()
proxy.http_url # http://user:pass@host:port (requests, httpx, curl, HTTPS_PROXY)
proxy.socks5_url() # socks5h://user:pass@host:5xxx (DNS resolved in Singapore too)
proxy.requests_proxies() # {"http": ..., "https": ...}
rotate_and_wait(proxy, Rotator.from_env()) # {"old_ip": ..., "new_ip": ..., "changed": true}
Mobile carriers sometimes hand the same IP back after a redial. changed is false then; rotate
again once the cooldown has passed.
Configuration
| Variable | Example | Notes |
|---|---|---|
SMP_PROXY |
host:8221:user:pass |
HTTP line, as shown in your dashboard. http://user:pass@host:port works too |
SMP_SOCKS_PROXY |
host:5221:user:pass |
SOCKS5 line. HTTP and SOCKS5 are separate ports |
SMP_HOST, SMP_HTTP_PORT, SMP_SOCKS_PORT, SMP_USERNAME, SMP_PASSWORD |
The same, as separate parts | |
SMP_ROTATE_URL |
Rotation link from your dashboard | |
SMP_API_KEY, SMP_LICENSE |
API rotation, instead of the link |
Try it offline
tests/mockproxy.py runs a local stand-in for a line (proxy port, rotation link and an IP-info
page), so you can try the quickstart without an account:
python tests/mockproxy.py # prints the SMP_* variables to export, then serves
More
- singapore-geo-testing: recipes for checking what a visitor in Singapore sees (geo-redirects, currency, cookie banners)
- setup-singapore-proxy: a GitHub Action that routes a CI job through a Singapore mobile IP
- singapore-proxy-mcp: the same lines as an MCP server for AI agents
MIT licensed. Not affiliated with Scrapy, Microsoft Playwright, or any carrier.
Metadata
Release files for singapore-mobile-proxy 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| singapore_mobile_proxy-0.1.0.tar.gz | 19.8 kB | With provenance | Details for singapore_mobile_proxy-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| singapore_mobile_proxy-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for singapore_mobile_proxy-0.1.0-py3-none-any.whl |
Total release size: 34.8 kB
Release files / singapore_mobile_proxy-0.1.0.tar.gz
| Download URL | singapore_mobile_proxy-0.1.0.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd03369474cc02b0def1d9f26ec179aedd43e1a299b684de9e32600cc381338a
|
|
BLAKE2b-256 checksum How to use checksums |
1b0baa1fb96f0f23bddc3294612f9f0470eb1115caccbefb96b46137983c6056
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logRelease files / singapore_mobile_proxy-0.1.0-py3-none-any.whl
| Download URL | singapore_mobile_proxy-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3743664ab378b0073d8368890bfe12fd99eefc5c9f43dafd0f7305860d97c50a
|
|
BLAKE2b-256 checksum How to use checksums |
1bcd55e935070c6f38c85149d82d37d766fb20747a17bc8e1da6daf6a709826d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logSecurity for singapore-mobile-proxy 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for singapore_mobile_proxy-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.