Skip to main content
POST
发送 SERP 请求
相关指南:SERP API 简介

Bright Data Python SDK

为了轻松开始使用我们的工具,请查看我们新的 Python SDK。

授权

Authorization
string
header
必填

在 Authorization 头中使用您的 Bright Data API Key 作为 Bearer token。

认证方法:

  1. 从 Bright Data 账户设置获取您的 API Key: https://brightdata.com/cp/setting/users
  2. 在请求的 Authorization 头中包含 API Key
  3. 格式: Authorization: Bearer YOUR_API_KEY

示例:

了解如何获取 Bright Data API Key: https://docs.brightdata.com/cn/api-reference/authentication#如何生成新的-api-key?

查询参数

async
boolean

设置为 true 以异步执行

请求体

application/json
zone
string
必填

区域标识符,用于定义您的 Bright Data 产品配置。每个区域包含目标规则、输出偏好和访问权限。 管理区域: https://brightdata.com/cp/zones

示例:

"serp_api1"

url
string
必填

要抓取的完整目标 URL。必须包含协议(http/https),并可公开访问。

示例:

"https://www.google.com/search?q=pizza"

format
enum<string>
必填

响应格式:raw 返回 HTML 字符串,json 返回结构化数据。

可用选项:
raw,
json
示例:

"json"

method
string
默认值:GET

通过代理请求 HTML 的方法为 GET。

示例:

"GET"

country
string

用于代理位置的两位 ISO 3166-1 国家代码(如 us、gb、de、ca、au)。如果未指定,系统会根据区域配置自动选择最佳位置。 国家代码列表: https://docs.brightdata.com/cn/general/faqs#where-can-i-see-the-list-of-country-codes

示例:

"us"

data_format
enum<string>

附加响应格式转换:markdown 将 HTML 转为干净的 Markdown,screenshot 截取页面 PNG 图片。

可用选项:
markdown,
screenshot
示例:

"markdown"

响应

OK

The response is of type string.

示例:

"OK"