Skip to content

Commit

Permalink
Adding minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lcsrodriguez committed Feb 16, 2024
1 parent 08d6d7b commit 0bd5b90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions earnings/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from enum import Enum

MAIN_URL: str = "https://www.earningswhispers.com"
DEFAULT_POST_OPTIONS: dict = {"expect": "Meet", "vote": "flat"}

Expand Down
8 changes: 5 additions & 3 deletions earnings/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def __new__(cls, *args, **kwargs):
return cls.instance

def __init__(self) -> None:
self.outputType: Output = Output.DICT
self.outputType: Output = Output.DICT # Default output type

@outputFormat
def getEarningsByDay(self, day: Union[str, datetime.datetime, datetime.date]) -> dict:
Expand All @@ -125,6 +125,8 @@ def getEarningsByDay(self, day: Union[str, datetime.datetime, datetime.date]) ->
if day.weekday() in [5, 6]:
raise Exception("weekend")
r = get(f"{MAIN_URL}/api/caldata/{day.isoformat().replace('-', '')}")
if r.status_code:
return None
return r.json()

@outputFormat
Expand Down Expand Up @@ -161,8 +163,8 @@ def _premCheck(self) -> bool:
def __str__(self) -> str:
return f"Earnings ({self._sym})"

def __repr__(self) -> None:
print(self.__str__())
def __repr__(self) -> str:
return self.__str__()

def __hash__(self) -> int:
return hash(self._sym)
Expand Down

0 comments on commit 0bd5b90

Please sign in to comment.