Skip to content

test_brightdata.py #71

@0903461

Description

@0903461

import requests

API_KEY = "2aeaa6b4-7ba5-4d9a-8b80-e31caea98888"

ZONE = "web_unlocker1"

url = "https://api.brightdata.com/request"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}

payload = {
"zone": ZONE,
"url": "https://creative.apple.com",
"format": "raw",

# Optional: location targeting
"country": "us",
"city": "seattle",
# "asn": 12345,  # if you know the ASN and it is enabled for your zone

}

try:
response = requests.post(url, json=payload, headers=headers, timeout=60)
response.raise_for_status()
result = response.json()

print("Status code from target site:", result.get("status_code"))
print("First 500 characters of page:")
print(result.get("body", "")[:500])

except Exception as e:
print("Error:", e)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions