Skip to content

Instantly share code, notes, and snippets.

@itssomething
Forked from felipeandres254/expa_auth.py
Created February 7, 2018 12:44
Show Gist options
  • Save itssomething/79d49eb7a91d524473d907556239f8a1 to your computer and use it in GitHub Desktop.
Save itssomething/79d49eb7a91d524473d907556239f8a1 to your computer and use it in GitHub Desktop.
Python 2.7 code snippet to get AIESEC EXPA Token
#!/usr/bin/env python
import re, requests
def GET_TOKEN( email=None, password=None ):
if email and password:
AUTH = {
"user[email]":email,
"user[password]":password
}
r = requests.post("https://auth.aiesec.org/users/sign_in", data=AUTH, verify=False)
return r.history[-1].cookies["expa_token"]
else:
r = requests.get("https://opportunities.aiesec.org/js/1.0.0.op.js", verify=False).text
return re.search(r'["\']?access_token["\']?:"(.*?)"', r).group(1)
if __name__=="__main__":
print "PUBLIC TOKEN ", GET_TOKEN()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment