Changes between Version 10 and Version 11 of login-service
- Timestamp:
- Jun 1, 2016, 3:39:13 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
login-service
v10 v11 53 53 === Python === 54 54 55 `mayfirstAuth` is a simple python module (currently only installed on `mcchesney`), source below. It allows a writer of any python script to easily query the login-service.56 57 55 '''Usage:''' 58 56 … … 60 58 #!/usr/bin/python 61 59 62 from mayfirstAuth import check, user 60 import requests 63 61 64 62 username = 'YOUR-USER-NAME' … … 66 64 appid = 'YOUR-APP-ID' 67 65 68 check = check(username, password, appid)69 user = user(username, appid)70 71 if check == "0":72 print 'Login success'73 else:74 print 'Login failure'75 76 if user == "0":77 print 'User exists'78 else:79 print 'User does not exist'80 }}}81 82 83 '''Source:'''84 85 Save this file as mayfirstAuth.py in /usr/local/lib/python2.7/dist-packages86 {{{87 #!/usr/bin/python88 89 import requests90 91 # set the login service URL92 66 url = 'https://id.mayfirst.org:8080/' 93 67 … … 114 88 return "0" 115 89 return "1" 90 91 if check(username, password, appid) == "0": 92 print 'Login success' 93 else: 94 print 'Login failure' 95 96 if user(username, appid) == "0": 97 print 'User exists' 98 else: 99 print 'User does not exist' 100 116 101 }}} 117 118 102 119 103 === PHP ===