Retrieving all Cookies in Python

后端 未结 4 650
余生分开走
余生分开走 2020-12-02 15:45

How do I read back all of the cookies in Python without knowing their names?

4条回答
  •  天涯浪人
    2020-12-02 16:49

    This may be exactly what you are looking for.

    Python 3.4

    import requests
    
    r = requests.get('http://www.about.com/')
    c = r.cookies
    i = c.items()
    
    for name, value in i:
        print(name, value)
    

提交回复
热议问题