Guest User

Untitled

a guest
Jan 22nd, 2019
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import requests
  2. import json
  3. import Cookie
  4.  
  5. USERNAME = "<user_name>"
  6. PASSWORD = "<password>"
  7. BACKEND = "https://blahblah.com"
  8.  
  9. # login will take orgId, email and password and return auth cookie for the user
  10. def login(email, password):
  11. url = 'https://auth-v2.blahblah.com/auth/v1.0/login'
  12. data = json.dumps({'email':email, 'password': password})
  13. r = requests.post(url,data=data,allow_redirects=False)
  14. cookieHeaders = filter(lambda x: x.lower()=='set-cookie',r.headers.keys())
  15. if len(cookieHeaders)==0:
  16. return None
  17. bc = Cookie.BaseCookie(r.headers[cookieHeaders[0]])
  18. sess = 'sess='+bc.values()[0].value
  19. return sess
  20.  
  21. foo = [1,2,3,4,5]
  22. len(filter(lambda x: x>2, foo))
  23.  
  24. foo = [1,2,3,4,5]
  25. len(list(filter(lambda x: x>2, foo)))
Add Comment
Please, Sign In to add comment