简体   繁体   中英

Deleting cookies and changing user agent in Python 3+ without Mechanize

How do I delete cookies from a web browser and change the user agent in Python 3+ without using mechanize? I'm not going to be accessing the web through Python, I would just like my browser (Firefox or Chrome) to delete cookies and change my user agent for example at every startup (I can do the startup bit, just not the rest!)

set the Expires attribute to a date in the past (like Epoch):

Set-Cookie: name=val; expires=Thu, 01 Jan 1970 00:00:00 GMT

Read more here: Correct way to delete cookies server-side

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM