使用python请求进行网络抓取-如何在发布后继续进行身份验证?

时间:2018-10-18 10:04:14

标签: python authentication post web-scraping python-requests

发布凭据后,使用python请求保留身份验证。

import requests
s = requests.session()
posturl= 'https://item-api-prod.liveauctioneers.com/auth/spalogin?c=20170802'
form = {'password': 'password', 'username': 'username'}
p=s.post(url=posturl, data = form)

到目前为止,验证成功,但是当尝试使用同一会话时,请求将挂起:

geturl = 'https://www.liveauctioneers.com/item/40018826_1930s-1950s-italian-german-hp-porcelain-children-items'

g=s.get(geturl)

...挂... 但是,如果我不在会话中,则返回成功但未通过身份验证:

g2=requests.get(geturl)

0 个答案:

没有答案
相关问题