Skip to content

Commit 8699ddf

Browse files
EmilRexbashtage
authored andcommitted
Allows user to input a custom base url to EnigmaReader (#499)
* Allows user to input a custom enigma base url * Added note to whatsnew * Adds all parameters to docstring for EnigmaReader
1 parent 3398e41 commit 8699ddf

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

docs/source/whatsnew/v0.7.0.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ Bug Fixes
3030
setting the environmental variable QUANDL_API_KEY (:issue:`485`).
3131
- Added back support for Yahoo! price data
3232
- Handle Morningstar index volume data properly (:issue:`486`).
33+
- Added support for optionally passing a custom base_url to the EnigmaReader (:issue:`499`).
3334
- Fixed Morningstar 'retry' incrementation (:issue:`513`)
34-
- Updated Google Daily Price API to functional url (:issue:`502`)
35+
- Updated Google Daily Price API to functional url (:issue:`502`)

pandas_datareader/enigma.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@ class EnigmaReader(_BaseReader):
1313
Collects current snapshot of Enigma data located at the specified
1414
data set ID and returns a pandas DataFrame.
1515
16+
Parameters
17+
----------
18+
dataset_id : str
19+
Enigma dataset UUID.
20+
api_key : str, optional
21+
Enigma API key. If not provided, the environmental variable
22+
ENIGMA_API_KEY is read.
23+
retry_count : int, (defaults to 5)
24+
Number of times to retry query request.
25+
pause : float, (defaults to 0.75)
26+
Time, in seconds, of the pause between retries.
27+
session : Session, (defaults to None)
28+
requests.sessions.Session instance to be used.
29+
base_url : str, optional (defaults to https://public.enigma.com/api)
30+
Alternative Enigma endpoint to be used.
31+
1632
Examples
1733
--------
1834
Download current snapshot for the following Florida Inspections Dataset:
@@ -32,7 +48,8 @@ def __init__(self,
3248
api_key=None,
3349
retry_count=5,
3450
pause=.75,
35-
session=None):
51+
session=None,
52+
base_url="https://public.enigma.com/api"):
3653

3754
super(EnigmaReader, self).__init__(symbols=[],
3855
retry_count=retry_count,
@@ -58,7 +75,7 @@ def __init__(self,
5875
'User-Agent': 'pandas-datareader',
5976
}
6077
self.session.headers.update(headers)
61-
self._base_url = "https://public.enigma.com/api"
78+
self._base_url = base_url
6279
self._retry_count = retry_count
6380
self._retry_delay = pause
6481

0 commit comments

Comments
 (0)