filelib/client.py
def acquire_access_token(self):
        """
        Acquire an ACCESS TOKEN by utilizing JWT(pyJwt)
        make a POST request to AUTHENTICATION_URL to acquire an access_token
        :return: None
        """

        # Make a pseudo request temporarily to acquire access_token
        jwt_headers = {}

        jwt_payload = {
            "filelib_api_key": self.__FILELIB_API_KEY,
            'request_client_source': REQUEST_CLIENT_SOURCE
        }
        jwt_encoded = jwt.encode(
            payload=jwt_payload,
            key=self.__FILELIB_API_SECRET,
            headers=jwt_headers
        )
        headers = {
            'FILELIB_API_KEY': self.__FILELIB_API_KEY,
            'Authorization': "Bearer {}".format(jwt_encoded.decode('utf-8'))
        }

        response = requests.post(self.AUTHENTICATION_URL, headers=headers)
        json_response = json.loads(response.content)
        assert response.ok, AcquiringAccessTokenFailedException(json_response.get('error', None))

        self.__ACCESS_TOKEN = json_response.get('data', {}).get('access_token')
        access_token_expiration = json_response.get('data', {}).get('expiration')
        access_token_expiration_date = datetime.strptime(access_token_expiration, DATETIME_PRINT_FORMAT)
        self.__ACCESS_TOKEN_EXPIRATION = access_token_expiration_date

        Acquire an ACCESS TOKEN by utilizing JWT(pyJwt)
        make a POST request to AUTHENTICATION_URL to acquire an access_token
        :return: None
        
Acquire an ACCESS TOKEN by utilizing JWT(pyJwt)
make a POST request to AUTHENTICATION_URL to acquire an access_token
Acquire an ACCESS TOKEN by utilizing JWT ( pyJwt ) make a POST request to AUTHENTICATION_URL to acquire an access_token
def acquire_access_token(self):
        jwt_headers = {}
        jwt_payload = {
            "filelib_api_key": self.__FILELIB_API_KEY,
            'request_client_source': REQUEST_CLIENT_SOURCE
        }
        jwt_encoded = jwt.encode(
            payload=jwt_payload,
            key=self.__FILELIB_API_SECRET,
            headers=jwt_headers
        )
        headers = {
            'FILELIB_API_KEY': self.__FILELIB_API_KEY,
            'Authorization': "Bearer {}".format(jwt_encoded.decode('utf-8'))
        }
        response = requests.post(self.AUTHENTICATION_URL, headers=headers)
        json_response = json.loads(response.content)
        assert response.ok, AcquiringAccessTokenFailedException(json_response.get('error', None))
        self.__ACCESS_TOKEN = json_response.get('data', {}).get('access_token')
        access_token_expiration = json_response.get('data', {}).get('expiration')
        access_token_expiration_date = datetime.strptime(access_token_expiration, DATETIME_PRINT_FORMAT)
        self.__ACCESS_TOKEN_EXPIRATION = access_token_expiration_date
def acquire_access_token ( self ) : jwt_headers = { } jwt_payload = { "filelib_api_key" : self . __FILELIB_API_KEY , 'request_client_source' : REQUEST_CLIENT_SOURCE } jwt_encoded = jwt . encode ( payload = jwt_payload , key = self . __FILELIB_API_SECRET , headers = jwt_headers ) headers = { 'FILELIB_API_KEY' : self . __FILELIB_API_KEY , 'Authorization' : "Bearer {}" . format ( jwt_encoded . decode ( 'utf-8' ) ) } response = requests . post ( self . AUTHENTICATION_URL , headers = headers ) json_response = json . loads ( response . content ) assert response . ok , AcquiringAccessTokenFailedException ( json_response . get ( 'error' , None ) ) self . __ACCESS_TOKEN = json_response . get ( 'data' , { } ) . get ( 'access_token' ) access_token_expiration = json_response . get ( 'data' , { } ) . get ( 'expiration' ) access_token_expiration_date = datetime . strptime ( access_token_expiration , DATETIME_PRINT_FORMAT ) self . __ACCESS_TOKEN_EXPIRATION = access_token_expiration_date
Acquire an ACCESS TOKEN by utilizing JWT(pyJwt)
make a POST request to AUTHENTICATION_URL to acquire an access_token
Acquire an ACCESS TOKEN by utilizing JWT ( pyJwt ) make a POST request to AUTHENTICATION_URL to acquire an access_token
"""
        Acquire an ACCESS TOKEN by utilizing JWT(pyJwt)
        make a POST request to AUTHENTICATION_URL to acquire an access_token
        :return: None
        """ # Make a pseudo request temporarily to acquire access_token
None
self