everything except tests

This commit is contained in:
James Maslek
2023-10-12 14:14:08 -04:00
parent a852f066d4
commit 2073acf00c
4 changed files with 45 additions and 4 deletions

View File

@@ -94,7 +94,9 @@ class TEEarningsCalendarFetcher(
raise RuntimeError(
"No url generated. Check combination of input parameters."
)
response = make_request(url.replace("api_key", api_key), **kwargs)
response = make_request(
url.replace("api_key", api_key if api_key else ""), **kwargs
)
if response.status_code != 200:
raise RuntimeError(f"Error in TE request -> {response.text}")
return response.json()

View File

@@ -0,0 +1,38 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Connection:
- keep-alive
method: GET
uri: https://api.tradingeconomics.com/calendar/country/All/2023-01-01/2023-10-10
response:
body:
string: You must provide valid credentials. Please contact support@tradingeconomics.com
headers:
APIServer:
- TEIIS1A
Access-Control-Allow-Credentials:
- 'true'
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Length:
- '79'
Content-Type:
- text/plain; charset=utf-8
Date:
- Thu, 12 Oct 2023 16:30:57 GMT
Expires:
- '-1'
Pragma:
- no-cache
status:
code: 401
message: Unauthorized
version: 1

View File

@@ -12,7 +12,7 @@ def vcr_config():
return {
"filter_headers": [("User-Agent", None)],
"filter_query_parameters": [
("token", "MOCK_TOKEN"),
("api_key", "mock_api_key"),
],
}
@@ -20,8 +20,8 @@ def vcr_config():
@pytest.mark.record_http
def test_te_earnings_calendar_fetcher(credentials=test_credentials):
params = {
"start_date": datetime.date(2023, 1, 1),
"end_date": datetime.date(2023, 6, 6),
"start_date": "2023-01-01",
"end_date": "2023-10-10",
}
fetcher = TEEarningsCalendarFetcher()

View File

@@ -15,6 +15,7 @@ openbb-fmp = "^0.1.0a2"
openbb-fred = "^0.1.0a2"
openbb-intrinio = "^0.1.0a2"
openbb-polygon = "^0.1.0a2"
openbb-tradingeconomics = "^0.1.0a2"
openbb-crypto = "^0.1.0a2"
openbb-economy = "^0.1.0a2"