Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 把403装进刮壳里_Python 3.x_Http_Scrapy_Cloudflare_Http Status Code 403 - Fatal编程技术网

Python 3.x 把403装进刮壳里

Python 3.x 把403装进刮壳里,python-3.x,http,scrapy,cloudflare,http-status-code-403,Python 3.x,Http,Scrapy,Cloudflare,Http Status Code 403,我正试图从中提取数据。当我试图用RESTClient发送请求时,我得到了200响应,而在scrapy shell中,我得到了403。我想我错过了一些东西,但却无法理解 header = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0', 'Content-Type': 'application/json', 'Accept': 'application/j

我正试图从中提取数据。当我试图用RESTClient发送请求时,我得到了
200
响应,而在scrapy shell中,我得到了
403
。我想我错过了一些东西,但却无法理解

header = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0',
 'Content-Type': 'application/json',
 'Accept': 'application/json, text/plain, */*',
 'Accept-Encoding': 'Accept-Encoding',
 'Host': 'api.bitclout.com',
 'Origin': 'https://explorer.bitclout.com',
 'Accept-Language': 'en-US,en;q=0.5',
 'Connection': 'keep-alive',
}

body = {'Height': 0, 'FullBlock': True}

url = 'https://api.bitclout.com/api/v1/block'

In [62]: fetch(scrapy.Request(url,method="POST",headers = header,body=json.dumps(body)))                                                              
2021-04-16 14:57:28 [scrapy.core.engine] DEBUG: Crawled (403) <POST https://api.bitclout.com/api/v1/block> (referer: None)
header={'User-Agent':'Mozilla/5.0(X11;Ubuntu;Linux x86_64;rv:87.0)Gecko/20100101 Firefox/87.0',
“内容类型”:“应用程序/json”,
“Accept':“application/json,text/plain,*/*”,
“接受编码”:“接受编码”,
“主机”:“api.bitclout.com”,
“来源”:https://explorer.bitclout.com',
‘接受语言’:‘en-US,en;q=0.5’,
“连接”:“保持活动状态”,
}
正文={'Height':0,'FullBlock':True}
url='1〕https://api.bitclout.com/api/v1/block'
在[62]中:获取(scrapy.Request(url,method=“POST”,headers=header,body=json.dumps(body)))
2021-04-16 14:57:28[scrapy.core.engine]调试:爬网(403)(参考:无)

使用Python的请求,cURL也给出了403-也就是说,不仅仅是Scrapy shell问题