github / github/dotnet-codespaces

test_brightdata.py

未關閉
#71 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
HTML
星號
245
分支
321
PR 合併指標
30 天內沒有已合併 PR

描述

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)

貢獻指南

開啟貢獻指南

研究方向

Start by reviewing test_brightdata.py and the requests.post call to https://api.brightdata.com/request. The issue does not specify what should change or how completion should be verified, so confirm the intended behavior before editing.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
api, backend
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
冷清
描述清晰度
需要釐清
新手友好度
20/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。