Created
December 23, 2013 05:01
-
-
Save Temptationx/8091843 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cookielib | |
import requests | |
index = sys.argv[1] | |
g_cookie = [] | |
gs = [] | |
def prepare(): | |
if os.path.exists(os.path.expanduser('~/cookies.txt'): | |
g_cookie = cookielib.MozillaCookieJar(os.path.expanduser('~/cookies.txt')) | |
g_cookie.load() | |
else: | |
raise Exception('~/cookies.txt not found.') | |
header = { | |
'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9) AppleWebKit/537.71 (KHTML, like Gecko) Version/7.0 Safari/537.71' | |
'Referer':'https://some.com' | |
} | |
gs = requests.Session() | |
gs.cookie = g_cookie | |
gs.headers = header |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment