diff --git a/ReadMe.md b/ReadMe.md index e0bc451..36a02ea 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -55,9 +55,11 @@ orgs = apiSession.getData('orgs') |Field| | -------| -|investments| -|orgs| |portfolios| +|orgs| +|orgs details| +|investments| +|investments transactions| |LookupData| |LookupValues| diff --git a/burgissApi/burgissApi.py b/burgissApi/burgissApi.py index 5114e7c..25cc9c3 100644 --- a/burgissApi/burgissApi.py +++ b/burgissApi/burgissApi.py @@ -32,6 +32,11 @@ def responseCodeHandling(response): """ if response.status_code == 200: return response + elif response.status_code == 404: + logger.error( + "Url not found") + raise ApiConnectionError( + 'Url not found, check the logs for the specific url!') else: logger.error( f"API Connection Failure: Error Code {response.status_code}") @@ -44,7 +49,7 @@ def lowerDictKeys(d): return newDict -class burgissApiAuth: +class burgissApiAuth(object): """ Create and send a signed client token to receive a bearer token from the burgiss api endpoint """ @@ -164,6 +169,7 @@ def request(self, url: str, analyticsApi: bool = False, requestType: str = 'GET' if self.tokenExpiration < datetime.utcnow(): logger.info('Token has expired, getting new token') self.token = self.auth.getBurgissApiToken() + self.tokenExpiration = datetime.utcnow() + timedelta(seconds=3600) else: logger.info('Token is still valid') diff --git a/setup.py b/setup.py index 2d1240a..24ca8fd 100644 --- a/setup.py +++ b/setup.py @@ -10,9 +10,9 @@ README = (HERE / "README.md").read_text() -VERSION = '0.0.3' -DESCRIPTION = 'An api request package for Burgiss' -LONG_DESCRIPTION = 'A package that makes it easy to make requests to the Burgiss API by simplifying the JWT token auth and various endpoints' +VERSION = '0.0.5' +DESCRIPTION = 'An api wrapper package for Burgiss' +LONG_DESCRIPTION = 'A package that makes it easy to make requests to the Burgiss API by simplifying the JWT token auth. Additional functionality includes data transformations.' setup( name="burgiss-api", diff --git a/tests/testDataTransformations.py b/tests/testDataTransformations.py index 568d20f..dc3572a 100644 --- a/tests/testDataTransformations.py +++ b/tests/testDataTransformations.py @@ -19,6 +19,18 @@ def testOrgsTransformation(): assert len(response) > 0 +def testInvestmentsTransformation(): + response = burgissApiSession.getData('investments') + assert isinstance(response, pd.DataFrame) == True + assert len(response) > 0 + + +def testPortfoliosTransformation(): + response = burgissApiSession.getData('portfolios') + assert isinstance(response, pd.DataFrame) == True + assert len(response) > 0 + + def testLookupValuesTransformation(): response = burgissApiSession.getData( 'LookupValues', profileIdAsHeader=True)