Skip to content

Commit 8d6c791

Browse files
author
Kevin Sheppard
committed
MAINT: Deprecate Enigma
Due to change in their business model Enigma is no longer working
1 parent 3624924 commit 8d6c791

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

pandas_datareader/enigma.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
from pandas_datareader.base import _BaseReader, string_types
77
from pandas_datareader.compat import StringIO
8+
from pandas_datareader.exceptions import (
9+
DEP_ERROR_MSG,
10+
ImmediateDeprecationError,
11+
)
812

913

1014
class EnigmaReader(_BaseReader):
@@ -52,6 +56,7 @@ def __init__(
5256
session=None,
5357
base_url="https://public.enigma.com/api",
5458
):
59+
raise ImmediateDeprecationError(DEP_ERROR_MSG.format("Enigma"))
5560

5661
super(EnigmaReader, self).__init__(
5762
symbols=[], retry_count=retry_count, pause=pause, session=session
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import os
2-
31
import pytest
42
from requests.exceptions import HTTPError
53

64
import pandas_datareader as pdr
75
import pandas_datareader.data as web
6+
from pandas_datareader.exceptions import ImmediateDeprecationError
87

98
pytestmark = pytest.mark.requires_api_key
109

11-
TEST_API_KEY = os.getenv("ENIGMA_API_KEY")
10+
TEST_API_KEY = "DEPRECATED"
1211

1312

14-
@pytest.mark.skipif(TEST_API_KEY is None, reason="no enigma_api_key")
1513
class TestEnigma(object):
1614
@property
1715
def dataset_id(self):
@@ -28,24 +26,24 @@ def setup_class(cls):
2826

2927
def test_enigma_datareader(self):
3028
try:
31-
df = web.DataReader(self.dataset_id, "enigma", api_key=TEST_API_KEY)
32-
assert "case_number" in df.columns
29+
with pytest.raises(ImmediateDeprecationError):
30+
web.DataReader(self.dataset_id, "enigma", api_key=TEST_API_KEY)
3331
except HTTPError as e:
3432
pytest.skip(e)
3533

3634
def test_enigma_get_data_enigma(self):
3735
try:
38-
df = pdr.get_data_enigma(self.dataset_id, TEST_API_KEY)
39-
assert "case_number" in df.columns
36+
with pytest.raises(ImmediateDeprecationError):
37+
pdr.get_data_enigma(self.dataset_id, TEST_API_KEY)
4038
except HTTPError as e:
4139
pytest.skip(e)
4240

4341
def test_bad_key(self):
44-
with pytest.raises(HTTPError):
42+
with pytest.raises(ImmediateDeprecationError):
4543
web.DataReader(self.dataset_id, "enigma", api_key=TEST_API_KEY + "xxx")
4644

4745
def test_bad_dataset_id(self):
48-
with pytest.raises(HTTPError):
46+
with pytest.raises(ImmediateDeprecationError):
4947
web.DataReader(
5048
"zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzz", "enigma", api_key=TEST_API_KEY
5149
)

0 commit comments

Comments
 (0)