API for Urban Rivals collection management
Project description
A module to support reading player purchase history data and storing it in a database.
- Puchases History Use:
Import api from urcollectionmanager
Create a request.Session and pass it, along with your credentials to session_connect_to_ur
Pass that same session (now authenticated) to get_purchase_history along with the number of pages to scrape.
Pass the result to convert_purchase_history
Optionally: Pass result to your own HTML parser.
You now have a list of Purchase objects that contain all relevant information available from the purchase history page.
- Missions Use:
Import api from urcollectionmanager
Create a request.Session and pass it, along with your credentials to session_connect_to_ur
Pass that same session (now authenticated) to get_missions_list along with the mission category to find. An empty string returns everything.
Pass the result to convert_missions
Optionally: Pass result to your own HTML parser.
You now have a list of Mission objects that contain all relevent information available from the missions page.
- Database Use:
Run connect_and_initialize_database if you have a particular database location you want to connect to. By default this will connect to data/collection.sqlite
Pass a list of Purchase objects to write_history_to_database
If using convert_purchase_history, you will need to flatten the list of lists
Once the database has Purchase objects in it, you can run get_history_from_database to retrieve them.
Similarly, you can run write_missions_to_database to write Mission objects and get_missions_from_database to read mission Mission objects from the same database as Purchases.
Dev
- How To Use Tools:
- Poetry
To run the project (preferably configure venv first)
>>> poetry install
To configure your venv
>>> python -m venv /path/to/new/virtual/environment >>> poetry env info
If env info does not match your path, try manually running Scripts/activate inside that environment
To add a dependency (add a -D if it’s only for development)
>>> poetry add <dependency>
- Commitizen
>>> git add >>> cz c
More options can be found under options under Commitizen
- PreCommit
Update .pre-commit-config.yaml, then run
>>> pre-commit install >>> pre-commit run --all-files
More hook plugins can be found at PreCommitHooks
TODO:
Use UR-API to collect player data. UR-API-Example
Default to file output (excel or some form of that)
Testing (pytest, Coverage-py)
Documentation (Sphinx)
Not Required at this Time:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for urcollectionmanager-1.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06dc44e3ae402b2580135bee36a8cd7790e2508752592b60d669b4f1625c4b3f |
|
MD5 | 8dacdf864abe6927b2a409a53013decb |
|
BLAKE2b-256 | f94966a7e39491507da28f9bdf9222ff5f34cb195f900e7804d8ae10d17be859 |
Hashes for urcollectionmanager-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7334f0fd0c8d7a3fcd0a52fe5224691739ee4a6b4b27b35deedf00a4369475f8 |
|
MD5 | 624347a5c9c559db0071e065c3361411 |
|
BLAKE2b-256 | 76890fd252d2dfa7dbe2904b1186b5e268296666cde36453702e1bb4477deb09 |