Skip to content

Commit a785ba3

Browse files
committed
Added not_found_error code
1 parent 9478e5e commit a785ba3

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

marketstack/models/error_code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ class ErrorCode(str, Enum):
88
INACTIVE_USER = "inactive_user"
99
HTTPS_ACCESS_RESTRICTED = "https_access_restricted"
1010
INVALID_API_FUNCTION = "invalid_api_function"
11-
NOT_FOUND = "404_not_found"
11+
VALUE_6 = "404_not_found"
12+
NOT_FOUND_ERROR = "not_found_error"
1213
USAGE_LIMIT_REACHED = "usage_limit_reached"
1314
RATE_LIMIT_REACHED = "rate_limit_reached"
1415
INTERNAL_ERROR = "internal_error"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
description="Inofficial Marketstack OpenAPI Python client",
1111
long_description=long_description,
1212
long_description_content_type="text/markdown",
13-
version="0.6.1",
13+
version="0.6.2",
1414
url="https://github.com/mreiche/marketstack-python",
1515
author="Mike Reiche",
1616
packages=find_packages(),

tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
def test_error_codes():
5-
assert ErrorCode.NOT_FOUND.value == "404_not_found"
5+
assert ErrorCode.NOT_FOUND_ERROR.value == "not_found_error"
66

77

88
def test_interval():

tests/test_tickers.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
tickers,
1414
)
1515
from marketstack.client import Client
16-
from marketstack.models import ErrorResponse
16+
from marketstack.models import ErrorResponse, ErrorCode
1717
from tests.setup import create_client, this_january, day_format
1818

1919
client: Client
@@ -47,6 +47,16 @@ def test_ticker_symbol():
4747
assert response.symbol == "AAPL"
4848

4949

50+
def test_ticker_symbol_not_found():
51+
response = ticker_symbol.sync(
52+
symbol="AYBABTO",
53+
client=client,
54+
access_key=os.getenv("MARKETSTACK_API_KEY"),
55+
)
56+
assert isinstance(response, ErrorResponse) is True
57+
assert response.error.code == ErrorCode.NOT_FOUND_ERROR
58+
59+
5060
def test_ticker_symbol_dividends():
5161
response = ticker_symbol_dividends.sync(
5262
symbol="AAPL",

0 commit comments

Comments
 (0)