How basic-bgnr/nepseunofficialapi works
Main Components
• Library Core: Represent the main package (the “nepse” directory) which contains modules such as NepseLib.py, DummyIDUtils.py, Errors.py, and TokenUtils.py. This is where all the core functionality (API calls, data processing, authentication key deciphering) is implemented.
• CLI Tool: Add a component labeled “nepse-cli” — show that this is a wrapper around the library’s core features, exposing commands to download floor sheets or start a local server.
• Example Server: Include a node for the “example/NepseServer.py” which shows how the library can be integrated into a web server (e.g., a Flask application running on localhost:8000).
Relationships and Interactions
• That data (like API endpoints and header configurations) feeds from the “data” component into the library core modules to support the API calls.
Architectural Patterns and Design Principles
• Modularity: Emphasize that the package is modular with separate files handling distinct responsibilities (authentication, error reporting, and token management) which is key for maintainability.
• Synchronous/Asynchronous Separation: Clearly show the dual nature of the API access. This separation is fundamental to the design, ensuring users can choose between blocking and non-blocking API calls.
• Externalized Configurations: Call out that the design uses JSON configuration files (from the data folder) which improves flexibility and ease of updates without changing code.
• CLI Layer: Highlight that the CLI tool acts as an adapter over the core library functionality to provide user-friendly interaction from the command line.
Technologies and Frameworks
• Python 3.11 (as required by the project)
• HTTP clients (likely httpx instead of requests, per the README’s mention of speed improvements and HTTP2 usage)
• Flask (for the example server in the example folder)
• WebAssembly (css.wasm may be involved in authentication or some specialized processing)
• GitHub Actions: You might optionally note the CI/CD workflows from the .github folder which indicate automated testing and deployment processes.