earningscall 0.0.4__py3-none-any.whl → 0.0.6__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 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": "demo",
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
- response = requests.get(f"{API_BASE}/symbols-v2.txt")
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
@@ -28,6 +30,8 @@ class Company:
28
30
 
29
31
  def _get_events(self):
30
32
  raw_response = api.get_events(self.company_info.exchange, self.company_info.symbol)
33
+ if not raw_response:
34
+ return []
31
35
  return [EarningsEvent.from_dict(event) for event in raw_response["events"]]
32
36
 
33
37
  def events(self) -> [EarningsEvent]:
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 MissingApiKeyError(ClientError):
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
- return Company(company_info=get_symbols().lookup_company(symbol))
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,22 +1,28 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: earningscall
3
- Version: 0.0.4
3
+ Version: 0.0.6
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
11
14
  Requires-Dist: dataclasses-json>=0.6.4
12
15
  Requires-Dist: dataclasses>=0.6
13
- Requires-Dist: more-itertools>=10.0.0
14
16
  Requires-Dist: requests>=2.30.0
15
17
  Description-Content-Type: text/markdown
16
18
 
17
19
  # EarningsCall Python Library
18
20
 
19
- The EarningsCall Python library provides convenient access to the EarningsCall API from
21
+ [![pypi](https://img.shields.io/pypi/v/earningscall.svg)](https://pypi.python.org/pypi/earningscall)
22
+ [![Build Status](https://github.com/EarningsCall/earningscall-python/actions/workflows/release.yml/badge.svg?branch=master)](https://github.com/EarningsCall/earningscall-python/actions?query=branch%3Amaster)
23
+ [![Coverage Status](https://coveralls.io/repos/github/EarningsCall/earningscall-python/badge.svg?branch=master)](https://coveralls.io/github/EarningsCall/earningscall-python?branch=master)
24
+
25
+ The EarningsCall Python library provides convenient access to the [EarningsCall API](https://earningscall.biz/api-guide) from
20
26
  applications written in the Python language. It includes a pre-defined set of
21
27
  classes for API resources that initialize themselves dynamically from API
22
28
  responses.
@@ -33,7 +39,6 @@ pip install --upgrade earningscall
33
39
 
34
40
  * Python 3.8+ (PyPI supported)
35
41
 
36
-
37
42
  ## Get Transcript for a Single Quarter
38
43
 
39
44
  ```python
@@ -99,3 +104,24 @@ from earningscall import get_all_companies
99
104
  for company in get_all_companies():
100
105
  print(f"{company.company_info} -- {company.company_info.sector} -- {company.company_info.industry}")
101
106
  ```
107
+
108
+ By default, this library grants you access to only two companies, Apple Inc. and Microsoft, Inc.
109
+
110
+ To gain access to 5,000+ companies please [signup here](https://earningscall.biz/api-pricing) to get your API key.
111
+
112
+ Once you have access to your API key, you can set the API Key like this:
113
+
114
+ ```python
115
+
116
+ import earningscall
117
+
118
+
119
+ earningscall.api_key = "YOUR SECRET API KEY GOES HERE"
120
+ ```
121
+
122
+ Alternatively, you can pass in your API key as an environment variable:
123
+
124
+ ```sh
125
+ export ECALL_API_KEY="YOUR SECRET API KEY GOES HERE"
126
+ python your-python-script.py
127
+ ```
@@ -0,0 +1,14 @@
1
+ earningscall/__init__.py,sha256=Hfh2BCnihAqfWV9niZrlfHmTNuL5tEKTW37bAXGLrF0,119
2
+ earningscall/api.py,sha256=_RnCSaZSUZJPvr_SiEk7YJZ8tkP9buLDQKReTWOZEPk,1749
3
+ earningscall/company.py,sha256=VyiHOajDBAx-G6dgWrPBUwWKjDpBvb0moZIpULPmiKA,1765
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.6.dist-info/METADATA,sha256=L-e9p7VEpoYTJ8kHvu49XgSU5TjB4Tjhr3KSxGE5BJo,4206
12
+ earningscall-0.0.6.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
13
+ earningscall-0.0.6.dist-info/licenses/LICENSE,sha256=ktEB_UcRMg2cQlX9wiDs544xWncWizwS9mEZuGsCLrM,1069
14
+ earningscall-0.0.6.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,,