Skip to content

Commit

Permalink
Add generic request method
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-kn committed Oct 31, 2020
1 parent bd676b1 commit 4b42305
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions comdirect_api/comdirect_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,15 @@ def get_report(self, product_type=None):
:return: Response object
"""
return self.report_service.get_report(product_type)

def get(self, endpoint, base_url='https://api.comdirect.de/api', **kwargs):
"""
Sends a generic GET-request to a given endpoint with given parameters
:param endpoint: endpoint without leading slash, e.g. 'banking/clients/clientId/v2/accounts/balances'
:param base_url: base url. Defaults to 'https://api.comdirect.de/api'
:param kwargs: query parameters
:return: Response object
"""
url = '{0}/{1}'.format(base_url, endpoint)
return self.session.get(url, params=kwargs).json()

0 comments on commit 4b42305

Please sign in to comment.