Skip to content

Commit

Permalink
Misc cleanup & adding a couple wrappers (#7)
Browse files Browse the repository at this point in the history
* iterate version

* shuffle module functions to static methods

* formatted with pyink

* added wrappers for fetch_logbook to LOTW

---------

Co-authored-by: Jacob Humble <[email protected]>
  • Loading branch information
JayToTheAy and Jacob Humble authored Nov 24, 2024
1 parent e9cd294 commit a8b0bc1
Show file tree
Hide file tree
Showing 8 changed files with 842 additions and 506 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install setuptools wheel build
- name: Build package
run: |
python -m build
Expand Down
3 changes: 2 additions & 1 deletion src/qspylib/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""unified version string"""
__version__ = '1.0.0a2'

__version__ = "1.0.0a3"
27 changes: 13 additions & 14 deletions src/qspylib/clublog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,44 @@
import requests
from .logbook import Logbook


class ClubLogError(Exception):
"""An error raised when an issue occurs with the ClubLog API."""
def __init__(self, message="An error occurred while interfacing with the ClubLog API"):

def __init__(
self, message="An error occurred while interfacing with the ClubLog API"
):
super().__init__(message)


class ClubLogClient:
"""This is a wrapper for the ClubLog API, holding a user's authentication\
to perform actions on their behalf.
"""

def __init__(self, email: str, callsign: str, password: str,
timeout: int = 15):
def __init__(self, email: str, callsign: str, password: str, timeout: int = 15):
"""Initializes a ClubLogClient object.
Args:
email (str): Email address for the ClubLog account
callsign (str): Callsign for the ClubLog account
password (str): Password for the ClubLog account
timeout (int, optional): Timeout for requests. Defaults to 15.
Args:
email (str): Email address for the ClubLog account
callsign (str): Callsign for the ClubLog account
password (str): Password for the ClubLog account
timeout (int, optional): Timeout for requests. Defaults to 15.
"""
self.email = email
self.callsign = callsign
self.password = password
self.timeout = timeout
self.base_url = "https://clublog.org/getadif.php"


def fetch_logbook(self) -> Logbook:
"""Fetch the user's ClubLog logbook.
Raises:
HTTPError: An error occurred while trying to make a connection.
Returns:
qspylib.logbook.Logbook: A logbook containing the user's QSOs.
"""
data = {
'email': self.email,
'password': self.password,
'call': self.callsign
}
data = {"email": self.email, "password": self.password, "call": self.callsign}
# filter down to only used params
data = {k: v for k, v in data.items() if v is not None}

Expand Down
Loading

0 comments on commit a8b0bc1

Please sign in to comment.