Connect a 9HTTP proxy sub-account to CloakBrowser in Python
You have a 9HTTP Dynamic Residential plan and want your Python browser to use it. The first detail to get right is the account: 9HTTP provides separate proxy sub-accounts, each with its own credentials and traffic limit. Your dashboard login is not the proxy login.
Quick answer: Create an enabled proxy sub-account, take a SOCKS5 connection from the matching Username/Password setup, and pass its host, port, username and password to CloakBrowser. Then open an IP check page inside the launched browser. This guide follows one username/password connection, without mixing in API extraction or IP whitelisting.
9HTTP is a CloakBrowser directory partner. This guide is part of our technical content collaboration.
Prepare your 9HTTP Dynamic Residential sub-account
You need an active Dynamic Residential plan, available traffic and a machine that can reach the proxy service. If you still need an account, get started with 9HTTP and choose Dynamic Residential for this walkthrough. You also need Python with CloakBrowser installed and license access configured. 9HTTP supplies the network connection; CloakBrowser launches the browser that uses it.
In a Python environment, install the wrapper with:
python -m pip install cloakbrowser
Have your existing CloakBrowser license key ready, or get a free key. If no key is configured, CloakBrowser can prompt for one in an interactive terminal. The CloakBrowser Quick Start shows a minimal Python launch to check before adding the proxy. The first browser launch may download the browser binary.
In the 9HTTP dashboard, follow User & Pass auth: Dynamic Residential Proxies → Username/Password → Sub-accounts → Create Sub-account. Save the generated credentials and set a usage limit appropriate for your test. An account with no usable traffic cannot complete the connection check.
Return to the Using Set-Up tab in that Username/Password area and obtain a SOCKS5 connection for the sub-account. Keep all fields from the same generated connection together.
| Value from your connection | What to enter in the script |
|---|---|
| Proxy host | Hostname or IPv4 only, without a scheme or credentials |
| SOCKS5 port | The numeric port supplied for that connection |
| Proxy username | The complete generated username, including any setup parameters |
| Proxy password | The matching sub-account password, not your dashboard password |
The script constructs the connection URL from those four values. It does not use an API extraction URL as a proxy address, and it does not assume the gateway address is your assigned exit IP.
Open the IP check page through CloakBrowser
Save this as check_9http.py and run python check_9http.py in an interactive terminal. The values are entered at runtime; the password prompt hides input. If the terminal cannot hide it, the script stops before asking for a visible password.
import warnings
from getpass import GetPassWarning, getpass
from ipaddress import IPv4Address
from urllib.parse import quote
from cloakbrowser import launch
warnings.simplefilter("error", GetPassWarning)
host = input("9HTTP SOCKS5 host: ").strip()
port = int(input("9HTTP SOCKS5 port: ").strip())
if not host or any(c in host for c in "/:@ "):
raise ValueError("Enter only the proxy hostname or IPv4.")
if not 1 <= port <= 65535:
raise ValueError("Enter a port from 1 to 65535.")
username = input("Complete proxy username: ").strip()
password = getpass("Proxy sub-account password: ")
if not username or not password:
raise ValueError("Both proxy credentials are required.")
proxy = (
f"socks5://{quote(username, safe='')}:{quote(password, safe='')}"
f"@{host}:{port}"
)
browser = launch(proxy=proxy)
try:
page = browser.new_page()
page.goto("https://api.ipify.org", timeout=30000)
observed = IPv4Address(page.locator("body").inner_text().strip())
print(f"Browser exit IPv4: {observed}")
finally:
browser.close()
The code opens ipify’s IPv4 text endpoint using page.goto. It then reads the page body. A successful run prints the IPv4 seen by that page. The credentials are URL-encoded so characters such as @ in a password do not become part of the host address.
To check the route, compare the result with the same IP page opened on the same machine in a browser that is not configured with this 9HTTP proxy. Keep any machine-wide VPN unchanged during the comparison. A different address is evidence that the routes differ. If the addresses match, inspect the two configurations before treating the result as a successful proxy check.
This Dynamic Residential example does not promise a fixed exit address across browser restarts. It also does not test every browser network channel. Once the connection check works, repeat it against your own test site and compare the IP recorded in its request logs.
If the connection fails
The script stops before opening a browser. A blank or nonnumeric port fails at the port input. A URL pasted into the host field fails the host check. Restart the script with the host and numeric SOCKS5 port in separate fields.
The browser launches, but the IP page does not load. Recheck the connection’s protocol and port, then the sub-account credentials. In 9HTTP, confirm the sub-account is enabled and has remaining traffic within its usage limit. If you recently edited its password, replace the saved value and repeat the same script. Do not switch to whitelist access halfway through diagnosing a username/password connection.
9HTTP’s connection FAQ also says the service is supported outside Mainland China and lists network connectivity and unavailable proxy IPs as possible causes. A browser error alone does not identify which one applies.
The returned page is not a plain IPv4 address. The script rejects it instead of printing an apparent success. Check whether the response is an error page and retry the same connection after resolving the cause.
Common questions
Do I need to whitelist my IP as well?
This walkthrough uses the username/password path. 9HTTP documents IP whitelisting separately, under API Extraction. Follow one complete authentication path for your connection.
Can I paste my extraction link into launch()?
No. A link that generates proxy entries is not itself the proxy endpoint. This script needs the host, port and credentials of the connection you intend to use.
Should the printed IP equal the proxy host?
Do not use the gateway hostname or address as your success criterion for a dynamic residential connection. Read the exit address from the page and verify the route independently.
Can I check with requests.get() instead?
That would test a separate HTTP client. Keep this check inside the browser with page.goto so you observe the browser’s request.
For the next step, read about browser automation failures and recovery.
Get started with 9HTTP, create your Dynamic Residential sub-account, and use it with the CloakBrowser Quick Start and the script above. Once the browser IP check succeeds, repeat the check against your own test site before building the rest of your workflow.
Disclosure: This article may contain referral links. CloakBrowser may earn a commission if you make a purchase through them.