一.问题描述
vscode利用requests库请求CSDNget类型接口报错ValueError: check_hostname requires server_hostname
代码如下:
'''
requests的基础使用-post请求
'''
import requests
# print('hello requests')
'''
requests库发送get参数---fiddler抓包,CSDN查看我的粉丝
'''
get_url1 = 'https://blog.csdn.net/community/home-api/v1/get-fans-list'
data_get = {
'page' : 1,
'size' : 20,
'noMore' : False,
'blogUsername' : 'xun_zhao_t521'
}
header = {
'Host': 'blog.csdn.net',
'Connection': 'keep-alive',
'sec-ch-ua': '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
'Accept': 'application/json, text/plain, */*',
'sec-ch-ua-mobile': '?0',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36',
'X-Tingyun-Id': 'C0UKgY0m8NI;r=713972543',
'Sec-Fetch-Site': 'same-origin',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty',
'Referer': 'https://blog.csdn.net/xun_zhao_t521?type=sub&subType=fans&spm=1008.2221.3001.5347',