我试图用scrapy做一个POST请求,但是当我用失眠或'requests'库做请求时,得到的响应不一样
My code with 'requests' lib:
import requests
formdata={'UF':'AM'}
response = requests.post('http://www.buscacep.correios.com.br/sistemas/buscacep/resultadoBuscaFaixaCep.cfm', data=formdata)
print(response.text) #this is the response i want
My code with scrapy:
import scrapy
class Get_uf_ceps(scrapy.Spider):
name = 'quotes'
def start_requests(self):
url = 'http://www.buscacep.correios.com.br/sistemas/buscacep/resultadoBuscaFaixaCep.cfm'
formdata = {
'UF': 'AM'
}
yield scrapy.FormRequest(url, formdata=formdata)
def parse(self, response):
print(response.text) # this response is not the same that i got with 'requests'
I want this table as a response, but it only get returned with insomnia or requests
目前没有回答
相关问题 更多 >
编程相关推荐