Skip to content

Instantly share code, notes, and snippets.

@felipeandres254
Last active April 16, 2018 19:16
Show Gist options
  • Save felipeandres254/1bfd8085edc230939f432fb370426b75 to your computer and use it in GitHub Desktop.
Save felipeandres254/1bfd8085edc230939f432fb370426b75 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()
@sladg
Copy link

sladg commented Apr 16, 2018

Hey! Would you mind updating? Expa is no longer returning expa_token at this request 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment