Using Python Requests: Sessions, Cookies, and POST

前端 未结 1 1746
傲寒
傲寒 2020-11-28 05:52

I am trying to scrape some selling data using the StubHub API. An example of this data seen here:

https://sell.stubhub.com/sellapi/event/4236070/section/null/seatmap

相关标签:
1条回答
  • 2020-11-28 06:27

    I don't know how stubhub's api works, but generally it should look like this:

    s = requests.Session()
    data = {"login":"my_login", "password":"my_password"}
    url = "http://example.net/login"
    r = s.post(url, data=data)
    

    Now your session contains cookies provided by login form. To access cookies of this session simply use

    s.cookies
    

    Any further actions like another requests will have this cookie

    0 讨论(0)
提交回复
热议问题