def get_visit(epn): api_username = current_app.config['PORTAL_USERNAME'] api_password = current_app.config['PORTAL_PASSWORD'] api_url = current_app.config['PORTAL_URL'] auth = Authentication(api_username, api_password, api_url) auth.login() api = PortalAPI(auth) try: return api.get_visit(epn, is_epn=True) except RequestFailed: return None
def __init__(self, username=None, password=None, token_data=None): super(User, self).__init__() if token_data: self.auth = Authentication.from_token_data(token_data) else: api_username = current_app.config['PORTAL_USERNAME'] api_password = current_app.config['PORTAL_PASSWORD'] api_url = current_app.config['PORTAL_URL'] self.auth = Authentication(api_username, api_password, api_url) self.auth.login(username, password) self.api = PortalAPI(self.auth)