Skip to content

Instantly share code, notes, and snippets.

@LunarArcanus
Created February 28, 2016 16:06
Show Gist options
  • Save LunarArcanus/170f2fbf3f63f6227d68 to your computer and use it in GitHub Desktop.
Save LunarArcanus/170f2fbf3f63f6227d68 to your computer and use it in GitHub Desktop.
Function to create a dict out of a document.cookie JS string
def make_cookie(string):
"""Creates a dictionary from the cookie string that
document.cookie returns (can be used in e.g requests)"""
cookie_split = [c.strip() for c in string.split(";")]
cookie_dict = dict(map(lambda x: x.split("="), cookie_split))
return cookie_dict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment