日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

python填表_小Python填表得到d

發(fā)布時(shí)間:2023/12/1 44 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python填表_小Python填表得到d 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

我正在嘗試使用Scrapy從網(wǎng)站自動(dòng)下載數(shù)據(jù)。在

我要做的是:使用我的憑據(jù)登錄網(wǎng)站

通過在“RIC”行中寫入代碼并選擇感興趣的時(shí)段來選擇我想要的數(shù)據(jù)

單擊“獲取數(shù)據(jù)”后,將生成.csv文件,我可以從“下載/”url下載該文件,其中我的所有文件如下所示:

我可以使用“FormRequest”登錄。因此,我想做同樣的事情來填充“RIC”代碼并單擊“Get data”按鈕,但這失敗了。(我現(xiàn)在改變?nèi)掌诓皇菫榱肆私馑墓ぷ髟?

這里是我的代碼:class DmozSpider(scrapy.Spider):

name = "dmoz"

allowed_domains = ["myDomain"]

start_urls = [

"http://myDomain/dataServices/"

]

def parse(self, response):

return scrapy.FormRequest.from_response(

response,

formdata={'username': 'myName', 'password': 'myPass'},

callback=self.after_login

)

def after_login(self, response):

# check login succeed before going on

if "Your email adress and password did not match" in response.body:

print("\n\nFAIL\n\n")

self.logger.error("Login failed")

return

else:

print("\n\n LOGIN SUCCESSFUL \n\n")

filename = response.url.split("/")[-2] + '.html'

with open(filename, 'wb') as f:

f.write(response.body)

## THIS FAILS !!!

return scrapy.http.FormRequest.from_response(

response,

formxpath='//input[@value = ""]',

formdata={'value': 'DJ@'},

clickdata={'value': 'Get data'},

callback= self.foo

)

這是表單的html:

^{pr2}$

我從日志中得到的錯(cuò)誤:2015-10-20 18:49:53 [scrapy] DEBUG: Retrying (failed 1 times): 500 Internal Server Error

2015-10-20 18:49:53 [scrapy] DEBUG: Retrying (failed 2 times): 500 Internal Server Error

2015-10-20 18:49:53 [scrapy] DEBUG: Gave up retrying (failed 3 times): 500 Internal Server Error

2015-10-20 18:49:53 [scrapy] DEBUG: Crawled (500) (referer: http://myDomain/dataServices/)

2015-10-20 18:49:53 [scrapy] DEBUG: Ignoring response <500 http://myDomain/dataServices/>: HTTP status code is not handled or not allowed

你知道我做錯(cuò)了什么嗎?在

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)

總結(jié)

以上是生活随笔為你收集整理的python填表_小Python填表得到d的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。