Compare commits
No commits in common. "1f989184d249b8124147c704f63c1ae55874c648" and "a27ffe6ddb1ee5ed8c545667e1a7e8e63ac3f2f7" have entirely different histories.
1f989184d2
...
a27ffe6ddb
|
@ -1,7 +1,3 @@
|
||||||
# WARNING!
|
|
||||||
# THIS IS AN AUTOGENERATED FILE!
|
|
||||||
# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN!
|
|
||||||
|
|
||||||
name: Build Python Container
|
name: Build Python Container
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
# WARNING!
|
|
||||||
# THIS IS AN AUTOGENERATED FILE!
|
|
||||||
# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN!
|
|
||||||
|
|
||||||
name: Package Python
|
name: Package Python
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
# WARNING!
|
|
||||||
# THIS IS AN AUTOGENERATED FILE!
|
|
||||||
# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN!
|
|
||||||
|
|
||||||
name: Run Python tests (through Pytest)
|
name: Run Python tests (through Pytest)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
# WARNING!
|
|
||||||
# THIS IS AN AUTOGENERATED FILE!
|
|
||||||
# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN!
|
|
||||||
|
|
||||||
name: Verify Python project can be installed, loaded and have version checked
|
name: Verify Python project can be installed, loaded and have version checked
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
|
@ -1,14 +1,3 @@
|
||||||
<!-- WARNING! -->
|
|
||||||
<!-- THIS IS AN AUTOGENERATED FILE! -->
|
|
||||||
<!-- MANUAL CHANGES CAN AND WILL BE OVERWRITTEN! -->
|
|
||||||
|
|
||||||
# Conventions
|
|
||||||
|
|
||||||
When contributing code to this project, you MUST follow the requirements
|
|
||||||
specified here.
|
|
||||||
|
|
||||||
## Code Conventions
|
|
||||||
|
|
||||||
When contributing code to this project, you MUST follow these principles:
|
When contributing code to this project, you MUST follow these principles:
|
||||||
|
|
||||||
- Code should be easy to read and understand.
|
- Code should be easy to read and understand.
|
||||||
|
@ -21,16 +10,3 @@ When contributing code to this project, you MUST follow these principles:
|
||||||
- Properly handle errors and exceptions to ensure the software's robustness.
|
- Properly handle errors and exceptions to ensure the software's robustness.
|
||||||
- Use exceptions rather than error codes for handling errors.
|
- Use exceptions rather than error codes for handling errors.
|
||||||
- Consider security implications of the code. Implement security best practices to protect against vulnerabilities and attacks.
|
- Consider security implications of the code. Implement security best practices to protect against vulnerabilities and attacks.
|
||||||
- Documentation should document semantics, not syntax.
|
|
||||||
- Prefer importing modules, not individual items from modules.
|
|
||||||
- Do not use f-strings in logging statements.
|
|
||||||
- Loop variables and walrus-expression-variables should be deleted when
|
|
||||||
unneeded to keep scope clean, and to avoid accidental use.
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
When contributing test to this project, you MUST follow these principles:
|
|
||||||
|
|
||||||
- Do not use any testing libraries other than `pytest`.
|
|
||||||
- Mocking is the root of all evil. Writing your own stubs is much more
|
|
||||||
preferable.
|
|
||||||
|
|
14
README.md
14
README.md
|
@ -1,6 +1,8 @@
|
||||||
<!-- WARNING! -->
|
<!--- WARNING --->
|
||||||
<!-- THIS IS AN AUTOGENERATED FILE! -->
|
<!--- THIS IS AN AUTO-GENERATED FILE --->
|
||||||
<!-- MANUAL CHANGES CAN AND WILL BE OVERWRITTEN! -->
|
<!--- MANUAL CHANGES CAN AND WILL BE OVERWRITTEN --->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Personal Data Fetcher Systems
|
# Personal Data Fetcher Systems
|
||||||
|
|
||||||
|
@ -61,7 +63,7 @@ Full list of requirements:
|
||||||
- [lxml](https://pypi.org/project/lxml/)
|
- [lxml](https://pypi.org/project/lxml/)
|
||||||
- [requests](https://pypi.org/project/requests/)
|
- [requests](https://pypi.org/project/requests/)
|
||||||
- [requests_cache](https://pypi.org/project/requests_cache/)
|
- [requests_cache](https://pypi.org/project/requests_cache/)
|
||||||
- [browser_cookie3](https://pypi.org/project/browser_cookie3/)
|
- [browsercookie](https://pypi.org/project/browsercookie/)
|
||||||
- [cfscrape](https://github.com/landryraccoon/cloudflare-scrape)
|
- [cfscrape](https://github.com/landryraccoon/cloudflare-scrape)
|
||||||
- [frozendict](https://pypi.org/project/frozendict/)
|
- [frozendict](https://pypi.org/project/frozendict/)
|
||||||
- [python-kucoin](https://pypi.org/project/python-kucoin/)
|
- [python-kucoin](https://pypi.org/project/python-kucoin/)
|
||||||
|
@ -71,12 +73,13 @@ Full list of requirements:
|
||||||
- [fin-depo](https://gitfub.space/Jmaa/fin-depo)
|
- [fin-depo](https://gitfub.space/Jmaa/fin-depo)
|
||||||
- [secret_loader](https://gitfub.space/Jmaa/secret_loader)
|
- [secret_loader](https://gitfub.space/Jmaa/secret_loader)
|
||||||
- [requests-util](https://gitfub.space/Jmaa/requests_util)
|
- [requests-util](https://gitfub.space/Jmaa/requests_util)
|
||||||
- [clients](https://gitfub.space/Jmaa/clients)
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Feel free to submit pull requests. Please follow the [Code Conventions](CONVENTIONS.md) when doing so.
|
Feel free to submit pull requests. Please follow the [Code Conventions](CONVENTIONS.md) when doing so.
|
||||||
|
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
Testing requires the [pytest](https://docs.pytest.org/en/stable/) library.
|
Testing requires the [pytest](https://docs.pytest.org/en/stable/) library.
|
||||||
|
@ -93,6 +96,7 @@ Test coverage can be run using the [`pytest-cov`](https://pypi.org/project/pytes
|
||||||
pytest --cov=personal_data test
|
pytest --cov=personal_data test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
import dataclasses
|
import dataclasses
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
|
import urllib.parse
|
||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
|
|
||||||
|
import bs4
|
||||||
|
|
||||||
|
from clients.myanimelist import MyAnimeListClient, MyAnimeListAnime, MyAnimeListSong
|
||||||
from clients import init_client
|
from clients import init_client
|
||||||
from clients.myanimelist import MyAnimeListAnime, MyAnimeListClient, MyAnimeListSong
|
|
||||||
|
|
||||||
from personal_data.data import DeduplicateMode, Scraper
|
from personal_data.data import DeduplicateMode, Scraper
|
||||||
|
|
||||||
from .. import secrets
|
from .. import secrets
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def client(session):
|
def client(session):
|
||||||
return init_client(MyAnimeListClient, session, secrets.secrets, throws=True)
|
return init_client(MyAnimeListClient, session, secrets.secrets, throws=True)
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
@dataclasses.dataclass(frozen=True)
|
||||||
class MyAnimeList(Scraper):
|
class MyAnimeList(Scraper):
|
||||||
dataset_name = 'myanimelist_anime'
|
dataset_name = 'myanimelist_anime'
|
||||||
|
|
|
@ -18,10 +18,10 @@ except ImportError:
|
||||||
logger.exception('cfscrape not installed: Certain fetchers might not work')
|
logger.exception('cfscrape not installed: Certain fetchers might not work')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import browser_cookie3
|
import browsercookie
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.exception('browser_cookie3 not installed: Certain fetchers might not work')
|
logger.exception('browsercookie not installed: Certain fetchers might not work')
|
||||||
browser_cookie3 = None
|
browsercookie = None
|
||||||
|
|
||||||
|
|
||||||
OUTPUT_PATH = Path('./output')
|
OUTPUT_PATH = Path('./output')
|
||||||
|
@ -94,11 +94,11 @@ def available_scraper_names() -> list[str]:
|
||||||
def get_cookiejar(use_cookiejar: bool):
|
def get_cookiejar(use_cookiejar: bool):
|
||||||
if use_cookiejar:
|
if use_cookiejar:
|
||||||
logger.warning('Got cookiejar from firefox')
|
logger.warning('Got cookiejar from firefox')
|
||||||
cookiejar = browser_cookie3.firefox()
|
cookiejar = browsercookie.firefox()
|
||||||
if len(cookiejar) > 10:
|
if len(cookiejar) > 10:
|
||||||
return cookiejar
|
return cookiejar
|
||||||
browser_cookie3.firefox(
|
browsercookie.firefox(
|
||||||
'/home/jmaa/.cachy/mbui5xg7.default-release/cookies.sqlite'
|
['/home/jmaa/.cachy/mbui5xg7.default-release/cookies.sqlite'],
|
||||||
)
|
)
|
||||||
if len(cookiejar) > 10:
|
if len(cookiejar) > 10:
|
||||||
return cookiejar
|
return cookiejar
|
||||||
|
|
|
@ -2,7 +2,6 @@ from secret_loader import SecretLoader
|
||||||
|
|
||||||
secrets = SecretLoader(env_key_prefix='CF_PD')
|
secrets = SecretLoader(env_key_prefix='CF_PD')
|
||||||
|
|
||||||
|
|
||||||
def load_lazy(key: str):
|
def load_lazy(key: str):
|
||||||
return lambda: secrets.load_or_fail(key)
|
return lambda: secrets.load_or_fail(key)
|
||||||
|
|
||||||
|
@ -16,15 +15,15 @@ ffxiv_character_id = load_lazy('FFXIV_CHARACTER_ID')
|
||||||
|
|
||||||
|
|
||||||
# Playstation
|
# Playstation
|
||||||
playstation_psn_id = load_lazy('PLAYSTATION_PSN_ID')
|
playstation_psn_id= load_lazy('PLAYSTATION_PSN_ID')
|
||||||
|
|
||||||
|
|
||||||
# Partisia Blockchain
|
# Partisia Blockchain
|
||||||
pbc_account_address = load_lazy('PBC_ACCOUNT_ADDRESS')
|
pbc_account_address= load_lazy('PBC_ACCOUNT_ADDRESS')
|
||||||
|
|
||||||
|
|
||||||
# Steam
|
# Steam
|
||||||
steam_username = load_lazy('STEAM_USERNAME')
|
steam_username= load_lazy('STEAM_USERNAME')
|
||||||
|
|
||||||
|
|
||||||
# Gitea
|
# Gitea
|
||||||
|
@ -32,20 +31,20 @@ gitea_access_token = load_lazy('GITEA_ACCESS_TOKEN')
|
||||||
|
|
||||||
|
|
||||||
# Kucoin
|
# Kucoin
|
||||||
kucoin_key = load_lazy('KUCOIN_KEY')
|
kucoin_key= load_lazy('KUCOIN_KEY')
|
||||||
|
|
||||||
|
|
||||||
kucoin_secret = load_lazy('KUCOIN_SECRET')
|
kucoin_secret= load_lazy('KUCOIN_SECRET')
|
||||||
|
|
||||||
|
|
||||||
kucoin_pass = load_lazy('KUCOIN_PASS')
|
kucoin_pass= load_lazy('KUCOIN_PASS')
|
||||||
|
|
||||||
|
|
||||||
# Kraken
|
# Kraken
|
||||||
kraken_key = load_lazy('KRAKEN_KEY')
|
kraken_key= load_lazy('KRAKEN_KEY')
|
||||||
|
|
||||||
|
|
||||||
kraken_secret = load_lazy('KRAKEN_SECRET')
|
kraken_secret= load_lazy('KRAKEN_SECRET')
|
||||||
|
|
||||||
|
|
||||||
# Home Assistant
|
# Home Assistant
|
||||||
|
|
|
@ -2,7 +2,7 @@ beautifulsoup4
|
||||||
lxml
|
lxml
|
||||||
requests
|
requests
|
||||||
requests_cache
|
requests_cache
|
||||||
browser_cookie3
|
browsercookie
|
||||||
cfscrape @ git+https://github.com/landryraccoon/cloudflare-scrape.git
|
cfscrape @ git+https://github.com/landryraccoon/cloudflare-scrape.git
|
||||||
frozendict
|
frozendict
|
||||||
python-kucoin
|
python-kucoin
|
||||||
|
|
15
setup.py
15
setup.py
|
@ -1,6 +1,8 @@
|
||||||
# WARNING!
|
# WARNING
|
||||||
# THIS IS AN AUTOGENERATED FILE!
|
#
|
||||||
# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN!
|
# THIS IS AN AUTOGENERATED FILE.
|
||||||
|
#
|
||||||
|
# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN.
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
@ -54,6 +56,7 @@ PACKAGE_DESCRIPTION_SHORT = """
|
||||||
This program collects several small data fetchers, for downloading personal
|
This program collects several small data fetchers, for downloading personal
|
||||||
data spread around the internet.""".strip()
|
data spread around the internet.""".strip()
|
||||||
|
|
||||||
|
|
||||||
def parse_version_file(text: str) -> str:
|
def parse_version_file(text: str) -> str:
|
||||||
match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text)
|
match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text)
|
||||||
if match is None:
|
if match is None:
|
||||||
|
@ -61,15 +64,17 @@ def parse_version_file(text: str) -> str:
|
||||||
raise Exception(msg)
|
raise Exception(msg)
|
||||||
return match.group(2)
|
return match.group(2)
|
||||||
|
|
||||||
|
|
||||||
with open(PACKAGE_NAME + '/_version.py') as f:
|
with open(PACKAGE_NAME + '/_version.py') as f:
|
||||||
version = parse_version_file(f.read())
|
version = parse_version_file(f.read())
|
||||||
|
|
||||||
|
|
||||||
REQUIREMENTS_MAIN = [
|
REQUIREMENTS_MAIN = [
|
||||||
'beautifulsoup4',
|
'beautifulsoup4',
|
||||||
'lxml',
|
'lxml',
|
||||||
'requests',
|
'requests',
|
||||||
'requests_cache',
|
'requests_cache',
|
||||||
'browser_cookie3',
|
'browsercookie',
|
||||||
'cfscrape @ git+https://github.com/landryraccoon/cloudflare-scrape.git',
|
'cfscrape @ git+https://github.com/landryraccoon/cloudflare-scrape.git',
|
||||||
'frozendict',
|
'frozendict',
|
||||||
'python-kucoin',
|
'python-kucoin',
|
||||||
|
@ -79,12 +84,12 @@ REQUIREMENTS_MAIN = [
|
||||||
'fin-depo @ git+https://gitfub.space/Jmaa/fin-depo.git',
|
'fin-depo @ git+https://gitfub.space/Jmaa/fin-depo.git',
|
||||||
'secret_loader @ git+https://gitfub.space/Jmaa/secret_loader',
|
'secret_loader @ git+https://gitfub.space/Jmaa/secret_loader',
|
||||||
'requests-util @ git+https://gitfub.space/Jmaa/requests_util',
|
'requests-util @ git+https://gitfub.space/Jmaa/requests_util',
|
||||||
'clients @ git+https://gitfub.space/Jmaa/clients',
|
|
||||||
]
|
]
|
||||||
REQUIREMENTS_TEST = [
|
REQUIREMENTS_TEST = [
|
||||||
'pytest',
|
'pytest',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name=PACKAGE_NAME,
|
name=PACKAGE_NAME,
|
||||||
version=version,
|
version=version,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user