eligibility_api/client.py
def _request(self, sub, name, types):
        """Make an API request for eligibility verification."""
        logger.debug("Start new eligibility verification request")

        try:
            token = self._tokenize_request(sub, name, types)
        except jwcrypto.JWException:
            raise TokenError("Failed to tokenize form values")

        try:
            logger.debug(f"GET request to {self.verify_url}")
            r = requests.get(self.verify_url, headers=self._auth_headers(token))
        except requests.ConnectionError:
            raise ApiError("Connection to verification server failed")
        except requests.Timeout:
            raise ApiError("Connection to verification server timed out")
        except requests.TooManyRedirects:
            raise ApiError("Too many redirects to verification server")
        except requests.HTTPError as e:
            raise ApiError(e)

        expected_status_codes = {200, 400}
        if r.status_code in expected_status_codes:
            logger.debug("Process eligiblity verification response")
            return self._tokenize_response(r)
        else:
            logger.warning(f"Unexpected eligibility verification response status code: {r.status_code}")
            raise ApiError("Unexpected eligibility verification response")
Make an API request for eligibility verification.
Make an API request for eligibility verification.
Make an API request for eligibility verification .
def _request(self, sub, name, types):
        logger.debug("Start new eligibility verification request")
        try:
            token = self._tokenize_request(sub, name, types)
        except jwcrypto.JWException:
            raise TokenError("Failed to tokenize form values")
        try:
            logger.debug(f"GET request to {self.verify_url}")
            r = requests.get(self.verify_url, headers=self._auth_headers(token))
        except requests.ConnectionError:
            raise ApiError("Connection to verification server failed")
        except requests.Timeout:
            raise ApiError("Connection to verification server timed out")
        except requests.TooManyRedirects:
            raise ApiError("Too many redirects to verification server")
        except requests.HTTPError as e:
            raise ApiError(e)
        expected_status_codes = {200, 400}
        if r.status_code in expected_status_codes:
            logger.debug("Process eligiblity verification response")
            return self._tokenize_response(r)
        else:
            logger.warning(f"Unexpected eligibility verification response status code: {r.status_code}")
            raise ApiError("Unexpected eligibility verification response")
def _request ( self , sub , name , types ) : logger . debug ( "Start new eligibility verification request" ) try : token = self . _tokenize_request ( sub , name , types ) except jwcrypto . JWException : raise TokenError ( "Failed to tokenize form values" ) try : logger . debug ( f"GET request to {self.verify_url}" ) r = requests . get ( self . verify_url , headers = self . _auth_headers ( token ) ) except requests . ConnectionError : raise ApiError ( "Connection to verification server failed" ) except requests . Timeout : raise ApiError ( "Connection to verification server timed out" ) except requests . TooManyRedirects : raise ApiError ( "Too many redirects to verification server" ) except requests . HTTPError as e : raise ApiError ( e ) expected_status_codes = { 200 , 400 } if r . status_code in expected_status_codes : logger . debug ( "Process eligiblity verification response" ) return self . _tokenize_response ( r ) else : logger . warning ( f"Unexpected eligibility verification response status code: {r.status_code}" ) raise ApiError ( "Unexpected eligibility verification response" )
Make an API request for eligibility verification.
Make an API request for eligibility verification .
"""Make an API request for eligibility verification."""
self
sub
name
types