earningscall 0.0.4__py3-none-any.whl → 0.0.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- earningscall/api.py +9 -2
- earningscall/company.py +3 -1
- earningscall/errors.py +5 -1
- earningscall/exports.py +7 -2
- earningscall/symbols.py +10 -1
- earningscall/utils.py +5 -0
- {earningscall-0.0.4.dist-info → earningscall-0.0.5.dist-info}/METADATA +30 -3
- earningscall-0.0.5.dist-info/RECORD +14 -0
- earningscall-0.0.4.dist-info/RECORD +0 -14
- {earningscall-0.0.4.dist-info → earningscall-0.0.5.dist-info}/WHEEL +0 -0
- {earningscall-0.0.4.dist-info → earningscall-0.0.5.dist-info}/licenses/LICENSE +0 -0
earningscall/api.py
CHANGED
@@ -19,6 +19,10 @@ def get_api_key():
|
|
19
19
|
return api_key
|
20
20
|
|
21
21
|
|
22
|
+
def is_demo_account():
|
23
|
+
return get_api_key() == "demo"
|
24
|
+
|
25
|
+
|
22
26
|
def get_events(exchange: str,
|
23
27
|
symbol: str):
|
24
28
|
|
@@ -41,7 +45,7 @@ def get_transcript(exchange: str,
|
|
41
45
|
|
42
46
|
log.debug(f"get_transcript year: {year} quarter: {quarter}")
|
43
47
|
params = {
|
44
|
-
"apikey":
|
48
|
+
"apikey": get_api_key(),
|
45
49
|
"exchange": exchange,
|
46
50
|
"symbol": symbol,
|
47
51
|
"year": str(year),
|
@@ -61,7 +65,10 @@ def get_symbols_v1():
|
|
61
65
|
|
62
66
|
|
63
67
|
def get_symbols_v2():
|
64
|
-
|
68
|
+
params = {
|
69
|
+
"apikey": get_api_key(),
|
70
|
+
}
|
71
|
+
response = requests.get(f"{API_BASE}/symbols-v2.txt", params=params)
|
65
72
|
if response.status_code != 200:
|
66
73
|
return None
|
67
74
|
return response.text
|
earningscall/company.py
CHANGED
@@ -15,7 +15,9 @@ class Company:
|
|
15
15
|
name: str
|
16
16
|
_events: [EarningsEvent]
|
17
17
|
|
18
|
-
def __init__(self, company_info):
|
18
|
+
def __init__(self, company_info: CompanyInfo):
|
19
|
+
if not company_info:
|
20
|
+
raise ValueError("company_info must be present.")
|
19
21
|
self.company_info = company_info
|
20
22
|
self.name = company_info.name
|
21
23
|
self._events = None
|
earningscall/errors.py
CHANGED
@@ -21,5 +21,9 @@ class ClientError(BaseError):
|
|
21
21
|
status: int = 400 # https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400
|
22
22
|
|
23
23
|
|
24
|
-
class
|
24
|
+
class InsufficientApiAccessError(ClientError):
|
25
|
+
pass
|
26
|
+
|
27
|
+
|
28
|
+
class CompanyNotFound(ClientError):
|
25
29
|
pass
|
earningscall/exports.py
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
|
1
3
|
from earningscall.symbols import get_symbols
|
2
4
|
|
3
5
|
from earningscall.company import Company
|
4
6
|
|
5
7
|
|
6
|
-
def get_company(symbol: str) -> Company:
|
7
|
-
|
8
|
+
def get_company(symbol: str) -> Optional[Company]:
|
9
|
+
company_info = get_symbols().lookup_company(symbol)
|
10
|
+
if company_info:
|
11
|
+
return Company(company_info=company_info)
|
12
|
+
return None
|
8
13
|
|
9
14
|
|
10
15
|
def get_all_companies() -> [Company]:
|
earningscall/symbols.py
CHANGED
@@ -4,7 +4,8 @@ import re
|
|
4
4
|
from collections import defaultdict
|
5
5
|
from typing import Optional
|
6
6
|
|
7
|
-
from earningscall.api import get_symbols_v2
|
7
|
+
from earningscall.api import get_symbols_v2, is_demo_account
|
8
|
+
from earningscall.errors import InsufficientApiAccessError
|
8
9
|
from earningscall.sectors import sector_to_index, industry_to_index, index_to_sector, index_to_industry
|
9
10
|
|
10
11
|
# WARNING: Add new indexes to the *END* of this list
|
@@ -127,6 +128,9 @@ class Symbols:
|
|
127
128
|
return _symbol
|
128
129
|
except KeyError:
|
129
130
|
pass
|
131
|
+
if is_demo_account():
|
132
|
+
raise InsufficientApiAccessError(f"For full access, please get an API Key. See: "
|
133
|
+
f"https://earningscall.biz/api-pricing")
|
130
134
|
return None
|
131
135
|
|
132
136
|
def remove_exchange_symbol(self, exchange_symbol: str):
|
@@ -224,3 +228,8 @@ def get_symbols() -> Symbols:
|
|
224
228
|
if not _symbols:
|
225
229
|
_symbols = load_symbols()
|
226
230
|
return _symbols
|
231
|
+
|
232
|
+
|
233
|
+
def clear_symbols():
|
234
|
+
global _symbols
|
235
|
+
_symbols = None
|
earningscall/utils.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import logging
|
1
2
|
import os
|
2
3
|
import pathlib
|
3
4
|
|
@@ -13,3 +14,7 @@ def project_file_path(base_dir, file_name):
|
|
13
14
|
|
14
15
|
def data_path(file_name=None):
|
15
16
|
return project_file_path("tests/data", file_name)
|
17
|
+
|
18
|
+
|
19
|
+
def enable_debug_logs():
|
20
|
+
logging.basicConfig(level=logging.DEBUG)
|
@@ -1,10 +1,13 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: earningscall
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.5
|
4
4
|
Summary: The EarningsCall Python library.
|
5
|
+
Project-URL: Homepage, https://earningscall.biz
|
5
6
|
Project-URL: Documentation, https://github.com/EarningsCall/earningscall-python
|
7
|
+
Project-URL: Repository, https://github.com/EarningsCall/earningscall-python
|
6
8
|
Project-URL: Issues, https://github.com/EarningsCall/earningscall-python/issues
|
7
9
|
Project-URL: Source, https://github.com/EarningsCall/earningscall-python
|
10
|
+
Project-URL: Changelog, https://github.com/EarningsCall/earningscall-python/blob/master/CHANGELOG.md
|
8
11
|
Author-email: EarningsCall <dev@earningscall.biz>
|
9
12
|
License-File: LICENSE
|
10
13
|
Requires-Python: >=3.8
|
@@ -16,7 +19,11 @@ Description-Content-Type: text/markdown
|
|
16
19
|
|
17
20
|
# EarningsCall Python Library
|
18
21
|
|
19
|
-
|
22
|
+
[](https://pypi.python.org/pypi/earningscall)
|
23
|
+
[](https://github.com/EarningsCall/earningscall-python/actions?query=branch%3Amaster)
|
24
|
+
[](https://coveralls.io/github/EarningsCall/earningscall-python?branch=master)
|
25
|
+
|
26
|
+
The EarningsCall Python library provides convenient access to the [EarningsCall API](https://earningscall.biz/api-guide) from
|
20
27
|
applications written in the Python language. It includes a pre-defined set of
|
21
28
|
classes for API resources that initialize themselves dynamically from API
|
22
29
|
responses.
|
@@ -33,7 +40,6 @@ pip install --upgrade earningscall
|
|
33
40
|
|
34
41
|
* Python 3.8+ (PyPI supported)
|
35
42
|
|
36
|
-
|
37
43
|
## Get Transcript for a Single Quarter
|
38
44
|
|
39
45
|
```python
|
@@ -99,3 +105,24 @@ from earningscall import get_all_companies
|
|
99
105
|
for company in get_all_companies():
|
100
106
|
print(f"{company.company_info} -- {company.company_info.sector} -- {company.company_info.industry}")
|
101
107
|
```
|
108
|
+
|
109
|
+
By default, this library grants you access to only two companies, Apple Inc. and Microsoft, Inc.
|
110
|
+
|
111
|
+
To gain access 5,000+ companies please [signup here](https://earningscall.biz/api-pricing) to get your API key.
|
112
|
+
|
113
|
+
Once you have access to your API key, you can set the API Key like this:
|
114
|
+
|
115
|
+
```python
|
116
|
+
|
117
|
+
import earningscall
|
118
|
+
|
119
|
+
|
120
|
+
earningscall.api_key = "YOUR SECRET API KEY GOES HERE"
|
121
|
+
```
|
122
|
+
|
123
|
+
Alternatively, you can pass in your API key as an environment variable:
|
124
|
+
|
125
|
+
```sh
|
126
|
+
export ECALL_API_KEY="YOUR SECRET API KEY GOES HERE"
|
127
|
+
python your-python-script.py
|
128
|
+
```
|
@@ -0,0 +1,14 @@
|
|
1
|
+
earningscall/__init__.py,sha256=Hfh2BCnihAqfWV9niZrlfHmTNuL5tEKTW37bAXGLrF0,119
|
2
|
+
earningscall/api.py,sha256=_RnCSaZSUZJPvr_SiEk7YJZ8tkP9buLDQKReTWOZEPk,1749
|
3
|
+
earningscall/company.py,sha256=Xi5kJPt14mLD7nTC8KEQhnJjRktmxb7pWMVdVUQ1TH0,1714
|
4
|
+
earningscall/errors.py,sha256=YTLkbhzWT_AURRL1IMlkkAKUiIW1L4V9Qh99bZnOtd8,488
|
5
|
+
earningscall/event.py,sha256=a5mcyfuCqPCopcKQUZ1HJyqHfAf-RNKnux_o68DIUHM,689
|
6
|
+
earningscall/exports.py,sha256=EfuxNiKnLktlD4ZtBm89qwfKRgKXh3C7bjleEhvBhzQ,590
|
7
|
+
earningscall/sectors.py,sha256=9aw14krRzdLJSTFC72Nwk3MQaXAIgkTBk5S-KTiki3U,5946
|
8
|
+
earningscall/symbols.py,sha256=fvqjnCbSAwfZB1dUrBUZFmJQ8C8V9uDzR0_C9RXMfIs,7722
|
9
|
+
earningscall/transcript.py,sha256=gV0Pqc9iilg4QQc89-ADEIcFQkQhFSnsJo8rvF7zKp0,192
|
10
|
+
earningscall/utils.py,sha256=wfwlSgFPPxr3GsFAsTjDNg_mLLK9V6p_2CwfetN5RR0,454
|
11
|
+
earningscall-0.0.5.dist-info/METADATA,sha256=p-Ps1OB2QmIssJMvS70roI6ElbGqumOhJK1z0gAMubM,4241
|
12
|
+
earningscall-0.0.5.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
13
|
+
earningscall-0.0.5.dist-info/licenses/LICENSE,sha256=ktEB_UcRMg2cQlX9wiDs544xWncWizwS9mEZuGsCLrM,1069
|
14
|
+
earningscall-0.0.5.dist-info/RECORD,,
|
@@ -1,14 +0,0 @@
|
|
1
|
-
earningscall/__init__.py,sha256=Hfh2BCnihAqfWV9niZrlfHmTNuL5tEKTW37bAXGLrF0,119
|
2
|
-
earningscall/api.py,sha256=lBUzBUjq_WNt4DH1usszG6OYJtBQbGYOy6KY0ags8ZI,1613
|
3
|
-
earningscall/company.py,sha256=fGbfh4S1m1K0rgkzpToYOrkPOZSJQieen6RJlSIvCjY,1610
|
4
|
-
earningscall/errors.py,sha256=Y5LVdvOMz_FgCXu4gXnyHceGvQwWmjHbkbRU2dsgdtA,433
|
5
|
-
earningscall/event.py,sha256=a5mcyfuCqPCopcKQUZ1HJyqHfAf-RNKnux_o68DIUHM,689
|
6
|
-
earningscall/exports.py,sha256=bG2ehoILyGTUrgRleuub4tXkiVGUdUZgsmoJ6giQgj4,478
|
7
|
-
earningscall/sectors.py,sha256=9aw14krRzdLJSTFC72Nwk3MQaXAIgkTBk5S-KTiki3U,5946
|
8
|
-
earningscall/symbols.py,sha256=mYWVO3YcUEr6JDxoH238_lsz67QHJGhk-o6jN1ot7R4,7372
|
9
|
-
earningscall/transcript.py,sha256=gV0Pqc9iilg4QQc89-ADEIcFQkQhFSnsJo8rvF7zKp0,192
|
10
|
-
earningscall/utils.py,sha256=g0MI9apoAQ2L7Ccj91mOHUWAE7zFbAvWqHPMjMJesFk,367
|
11
|
-
earningscall-0.0.4.dist-info/METADATA,sha256=1U9i621evx8KJEcdpm9iOgVV8Vrkeyr19APTa-DqTek,2935
|
12
|
-
earningscall-0.0.4.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
13
|
-
earningscall-0.0.4.dist-info/licenses/LICENSE,sha256=ktEB_UcRMg2cQlX9wiDs544xWncWizwS9mEZuGsCLrM,1069
|
14
|
-
earningscall-0.0.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|