Written by Mr Li2023-08-30
用python实现百度收录API提交
帮助手册 Article
import requests
# 百度收录API的URL
url = "http://data.zz.baidu.com/urls?site=your_website_url&token=your_token"
# 要提交的网址列表
urls_to_submit = [
"http://www.example.com/page1",
"http://www.example.com/page2",
]
# 构建请求头
headers = {
"User-Agent": "curl/7.12.1",
"Host": "data.zz.baidu.com",
}
# 构建请求参数
data = "\n".join(urls_to_submit)
# 发送POST请求
response = requests.post(url, data=data, headers=headers)
# 解析响应
if response.status_code == 200:
result = response.text
print("提交结果:", result)
else:
print("请求失败,HTTP状态码:", response.status_code)
You may also like
You may be interested
php中的mysql_fetch_row/mysql_fetch_array/mysql_fetch_object的区分区别和使用方法
星期一, 29 7 月 2019By 99122524
1、mysql_fe...
归档
- 2023 年 9 月
- 2023 年 8 月
- 2023 年 7 月
- 2023 年 6 月
- 2023 年 5 月
- 2023 年 4 月
- 2023 年 3 月
- 2023 年 2 月
- 2022 年 11 月
- 2022 年 10 月
- 2022 年 1 月
- 2021 年 12 月
- 2021 年 10 月
- 2021 年 7 月
- 2021 年 4 月
- 2021 年 3 月
- 2021 年 2 月
- 2020 年 11 月
- 2020 年 10 月
- 2020 年 5 月
- 2020 年 4 月
- 2020 年 3 月
- 2020 年 2 月
- 2020 年 1 月
- 2019 年 12 月
- 2019 年 11 月
- 2019 年 10 月
- 2019 年 8 月
- 2019 年 7 月
Calendar
一 | 二 | 三 | 四 | 五 | 六 | 日 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |