Last active
April 16, 2018 19:16
-
-
Save felipeandres254/1bfd8085edc230939f432fb370426b75 to your computer and use it in GitHub Desktop.
Python 2.7 code snippet to get AIESEC EXPA Token
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
#!/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
Hey! Would you mind updating? Expa is no longer returning expa_token at this request 😢