Scrape a web page that requires they give you a session cookie first

后端 未结 2 631
故里飘歌
故里飘歌 2020-12-13 22:35

I\'m trying to scrape an excel file from a government \"muster roll\" database. However, the URL I have to access this excel file:

http://nrega.ap.gov.in/Nregs/Front

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 23:20

    Using requests this is a trivial task:

    >>> url = 'http://httpbin.org/cookies/set/requests-is/awesome'
    >>> r = requests.get(url)
    
    >>> print r.cookies
    {'requests-is': 'awesome'}
    

提交回复
热议问题