Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import datetime
- def convert_cookies(cookie_file):
- buffer = ['# Netscape HTTP Cookie File', '']
- with open(cookie_file, 'r') as f:
- for line in f:
- name, value, domain, path, expires, _, _, secure, _, _ = line.strip().split("\t")
- expires_dt = int(datetime.fromisoformat(expires.rstrip('Z')).timestamp()) if expires != 'Session' else ''
- if secure:
- secure = 'TRUE'
- buffer.append('\t'.join([domain, 'TRUE', path, secure, str(expires_dt), name, value]))
- with open(cookie_file, 'w') as f:
- f.write("\n".join(buffer))
Add Comment
Please, Sign In to add comment