Skip to content

Instantly share code, notes, and snippets.

@Temptationx
Created December 23, 2013 05:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Temptationx/8091843 to your computer and use it in GitHub Desktop.
Save Temptationx/8091843 to your computer and use it in GitHub Desktop.
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