mirror of
https://github.com/hydrosquall/tiingo-python.git
synced 2025-12-18 04:14:20 +01:00
Cleanup Docstrings, Tests, and Todos
This commit is contained in:
@@ -3,6 +3,7 @@ import requests
|
||||
from requests.exceptions import HTTPError
|
||||
|
||||
|
||||
# TODO: Possibly print HTTP json response if available?
|
||||
class RestClientError(Exception):
|
||||
"Wrapper around HTTP Errors"
|
||||
pass
|
||||
@@ -12,11 +13,10 @@ class RestClient(object):
|
||||
|
||||
def __init__(self, config={}):
|
||||
"""Base class for interacting with RESTful APIs
|
||||
|
||||
Child class MUST have a ._base_url property!
|
||||
|
||||
Args:
|
||||
config (dict): Arbitrary configuration options
|
||||
config (dict): Arbitrary options that child classes can access
|
||||
"""
|
||||
self._config = config
|
||||
|
||||
@@ -29,7 +29,13 @@ class RestClient(object):
|
||||
return '<RestClient(url="{}")>'.format(self._base_url)
|
||||
|
||||
def _request(self, method, url, **kwargs):
|
||||
"""Make HTTP request and return response object"""
|
||||
"""Make HTTP request and return response object
|
||||
|
||||
Args:
|
||||
method (str): GET, POST, PUT, DELETE
|
||||
url (str): path appended to the base_url to create request
|
||||
**kwargs: passed directly to a requests.request object
|
||||
"""
|
||||
resp = self._session.request(method,
|
||||
'{}/{}'.format(self._base_url, url),
|
||||
headers=self._headers,
|
||||
|
||||
Reference in New Issue
Block a user