-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
672059c
commit 65f64c7
Showing
9 changed files
with
798 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
|
||
class BaseError(RuntimeError): | ||
""" | ||
Base error | ||
""" | ||
|
||
def __init__(self, msg=None): | ||
self.msg = msg | ||
|
||
def __str__(self): | ||
if self.msg: | ||
return str(self.msg) | ||
return "" | ||
|
||
|
||
class ClientError(BaseError): | ||
""" | ||
Used to return 4XX errors. | ||
""" | ||
status: int = 400 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 | ||
|
||
|
||
class MissingApiKeyError(ClientError): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import responses | ||
|
||
from earningscall import get_company | ||
from earningscall.utils import data_path | ||
|
||
|
||
# Uncomment following code to generate msft-transcript-response.yaml file | ||
# | ||
# from responses import _recorder | ||
# @_recorder.record(file_path="msft-transcript-response.yaml") | ||
# def test_save_symbols_v1(): | ||
# requests.get("https://v2.api.earningscall.biz/transcript?apikey=demo&exchange=NASDAQ&symbol=MSFT&year=2023&quarter=1") | ||
|
||
|
||
@responses.activate | ||
def test_get_demo_company(): | ||
## | ||
responses._add_from_file(file_path=data_path("symbols-v2.yaml")) | ||
responses._add_from_file(file_path=data_path("msft-transcript-response.yaml")) | ||
## | ||
company = get_company("msft") | ||
## | ||
transcript = company.get_transcript(year=2023, quarter=1) | ||
assert transcript.text[:100] == ('Greetings, and welcome to the Microsoft Fiscal Year 2023 First Quarter Earnings ' | ||
'Conference Call. At ') | ||
|
||
|
||
# @responses.activate | ||
# def test_get_non_demo_company(): | ||
# ## | ||
# responses._add_from_file(file_path=data_path("symbols-v2.yaml")) | ||
# # responses._add_from_file(file_path=data_path("msft-transcript-response.yaml")) | ||
# ## | ||
# company = get_company("nvda") | ||
# ## | ||
# transcript = company.get_transcript(year=2023, quarter=1) | ||
# assert transcript.text[:100] == ('Greetings, and welcome to the Microsoft Fiscal Year 2023 First Quarter Earnings ' | ||
# 'Conference Call. At ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters