Download cookieFix.py from hashir672/Python-red-gen-space: direct link, hf CLI and curl.
- Browser
- Download file 592 Bytes
-
https://huggingface.co/spaces/hashir672/Python-red-gen-space/resolve/main/cookieFix.py
- Command line
-
hf download hf://spaces/hashir672/Python-red-gen-space/cookieFix.py
-
curl -L -o cookieFix.py https://huggingface.co/spaces/hashir672/Python-red-gen-space/resolve/main/cookieFix.py
592 Bytes
| import re | |
| import fileinput | |
| def fixCookie(cookiefile): | |
| for line in fileinput.FileInput(cookiefile,inplace=1): | |
| if re.match("======",line): | |
| break | |
| print(line.replace("\n","")) | |
| fixCookie("./cookiesLocal.txt") | |
| # cookies=[] | |
| # with open("./cookiesLocal.txt", 'r+') as fp: | |
| # for line in fp: | |
| # if not re.match(r'^\#', line): | |
| # lineFields = line.strip().split('\t') | |
| # try: | |
| # cookies[lineFields[5]] = lineFields[6] | |
| # fp.write(line) | |
| # except: | |
| # print("Invalid cookie") | |
| # pass | |
| # print(str(cookies)) |