Make one ordinary HTML GET to verify execution, URL mapping and returned content. This is not a full-site crawler and does not escalate API versions automatically.
- 1. Read secure variablesKey and target URL
- 2. Map the requestPreserve path/query
- 3. Check status and typeNo automatic redirects
- 4. Read the titleStop on failure
1. Prepare the runtime
Follow API Key & Runtime Setup for credentials, requests and TARGET_URL
2. Save the complete request file
Save the code as cloudbypass_first_request.py. This ordinary-page test uses V1. The API URL retains the target path/query; x-cb-host carries the target host.
"""One V1 HTML request. Configure credentials locally; never print request headers."""
import os
from html.parser import HTMLParser
from urllib.parse import urlsplit, urlunsplit
import requests
class PageTitle(HTMLParser):
def __init__(self):
super().__init__()
self.inside = False
self.parts = []
def handle_starttag(self, tag, attrs):
if tag.lower() == 'title':
self.inside = True
def handle_endtag(self, tag):
if tag.lower() == 'title':
self.inside = False
def handle_data(self, data):
if self.inside:
self.parts.append(data)
def required(name):
value = os.environ.get(name, '').strip()
if not value:
raise ValueError(f'Set {name} in the actual runtime; do not share its value in chat.')
return value
def main():
target = urlsplit(required('TARGET_URL'))
if target.scheme not in ('http', 'https') or not target.hostname or target.username or target.password:
raise ValueError('Use a complete HTTP(S) URL without embedded credentials.')
api_url = urlunsplit(('https', 'api.cloudbypass.com', target.path or '/', target.query, ''))
headers = {
'x-cb-apikey': required('CLOUDBYPASS_APIKEY'),
'x-cb-host': target.netloc,
'x-cb-protocol': target.scheme,
'x-cb-timeout': '60',
}
with requests.get(api_url, headers=headers, timeout=(15, 90), allow_redirects=False, stream=True) as response:
if response.headers.get('x-cb-status', '').lower() != 'ok':
raise RuntimeError(f'API success not confirmed; HTTP {response.status_code}. Inspect redacted code/message locally.')
if not 200 <= response.status_code < 300:
raise RuntimeError(f'Target returned HTTP {response.status_code}; do not retry automatically.')
if 'text/html' not in response.headers.get('Content-Type', '').lower():
raise RuntimeError('Expected HTML. Check the target and required output format.')
body = bytearray()
for chunk in response.iter_content(chunk_size=8192):
body.extend(chunk)
if len(body) > 262144:
raise RuntimeError('HTML exceeds this starter example limit; adapt the reader before continuing.')
parser = PageTitle()
parser.feed(body.decode(response.encoding or 'utf-8', errors='replace'))
print('HTTP:', response.status_code, '| Cloudbypass:', response.headers['x-cb-status'])
print('Title:', ' '.join(''.join(parser.parts).split()) or '(no title found)')
if __name__ == '__main__':
try:
main()
except requests.RequestException as error:
raise SystemExit(f'Network request failed ({type(error).__name__}); inspect redacted diagnostics locally.')
3. Run once manually
Use the virtual-environment interpreter for your system. Real requests may incur charges; confirm the target and one-attempt budget first.
.\.venv\Scripts\python.exe cloudbypass_first_request.py
./.venv/bin/python cloudbypass_first_request.py
4. Inspect the actual result
- A successful path prints HTTP status, Cloudbypass status and title. These are expected fields, not evidence of a test performed for you.
- Compare example.com with its intended page, then validate your own business fields for another target.
- Stop on login/error pages, missing titles or wrong content types; do not ask a model to invent missing data.
- 256 KiB is this starter reader limit, not a product limit.
Frequently asked questions
What about paths and ports?
Use a complete TARGET_URL. The code preserves path, query and target port; URL fragments are not sent.
Can I switch to V2 by changing one line?
First establish the need, then configure stable proxy/session parameters from the documentation. This example does not escalate automatically.
Does the network error expose my key?
The example reports the exception type without full request headers. Review any logging you add with the same restrictions.