How bcanfield/southpaw works
Project Overview
• Southpaw is a Python package built as a wrapper around the Fanduel API.
• It enables users to authenticate with Fanduel (using email, password, and specific auth tokens) and provides a rich set of helper functions for retrieving contest data, fetching available players, and updating DFS lineups.
• It is intended for programmatic interactions with the Fanduel platform, essentially serving as an API client.
Main Components
a. Southpaw Package:
• Core Library: Represent the main library as the “Southpaw API Client.”
• This includes the entry point (southpaw/__init__.py) and the core functionality (southpaw/fanduel.py) responsible for interacting with the API.
• Authentication Module: Although not split into distinct files, the authentication process (e.g., providing email, password, Basic auth, and X-Auth-Token credentials for initial login and subsequent API requests) is a crucial element.
b. API Interaction:
• Two-step authentication mechanism updated in October 2023, where users have to manually retrieve auth headers.
c. External Dependencies & Packaging:
• Setup and Distribution: Incorporate build-related components like setup.py, pyproject.toml, and requirements.txt. This shows how the package is packaged, distributed, and installed via pip.
• GitHub Workflows and CI/CD: Briefly note the existence of CI/CD pipelines (from the .github/workflows) to verify, test, and release the package.
d. Testing Framework:
• Unit Tests: Represent the tests directory (southpaw/tests) that includes unit tests (e.g., test_fanduel.py and test data under testData).
• This component ensures that the Southpaw client works correctly and interacts with the Fanduel API as expected.
Relationships and Interactions
• Data flow back from the Fanduel API to the client.
• Connections between the client and test suite, emphasizing that the tests simulate and verify these interactions.
Architectural Patterns and Principles
• Separation of concerns:
• Authentication and API interaction are managed within the Southpaw client.
• Testing components are isolated in a separate tests directory.
• The use of a wrapper/wrapper pattern for the Fanduel API can be highlighted as it abstracts away the complex API details.
• Mention that the design caters for ease-of-maintenance and extensibility (e.g., adding helper functions or supporting additional endpoints in the future).