pass session cookies in http header with python urllib2?

后端 未结 1 1270
面向向阳花
面向向阳花 2021-01-12 07:52

I\'m trying to write a simple script to log into Wikipedia and perform some actions on my user page, using the Mediawiki api. However, I never seem to get past the first log

1条回答
  •  北海茫月
    2021-01-12 08:26

    The latest version of requests has support for sessions (as well as being really simple to use and generally great):

    with requests.session() as s: 
        s.post(url, data=user_data)
        r = s.get(url_2)
    

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