blob: a421cf8cd796c790fed1ffdf15dbe3468a14ad6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import requests
from user import User
from config import Config
import urllib
class AuthHandler:
@staticmethod
def authenticate(username, password):
session = requests.Session()
hostname = Config.config.get("cas", "auth_url") + urllib.quote(Config.config.get("api", "url")) + Config.config.get("cas", "signin_return")
data = {'name': username, 'pass': password, 'form_id': 'user_login'}
response = session.post(hostname, data)
User.session = session
return response
|