def product_search( search_term: str, auth_session: OAuth2Session ) -> requests.models.Response: """ Search for products matching a short search term. Parameters ---------- search_term A search term of at least 3 characters and no more than 8 words. auth_session An active OAuth2 session with "product.compact" auth scope. Returns ------- requests.models.Response Server response, including product data on `.json()`. """ return auth_session.get( _PRODUCT_ENDPOINT, params={ "filter.term": search_term, "filter.fulfillment": "csp", # Curbside pickup only "filter.limit": 50, "filter.locationId": _LOCATION_ID, }, )
def list_profiles(self, session: OAuth2Session) -> Iterable['Profile']: # https://github.com/eduvpn/documentation/blob/v3/API.md#info response = session.get(self.api_call_endpoint('info')) remote.check_response(response) profiles = response.json()['info']['profile_list'] return [Profile(**data) for data in profiles]
def check_certificate(oauth: OAuth2Session, api_base_uri: str, certificate: str): common_name = common_name_from_cert(certificate.encode('ascii')) response = oauth.get(api_base_uri + '/check_certificate?common_name=' + common_name) return response.json()['check_certificate']['data']['is_valid']
def system_messages(oauth: OAuth2Session, api_base_uri: str): response = oauth.get(api_base_uri + '/system_messages') return response.json()['system_messages']['data']