mirror of
https://github.com/kittywitch/konawall-py.git
synced 2026-02-09 04:19:19 -08:00
feat(e621): add environment variable setter
This commit is contained in:
parent
e426a3ee4e
commit
b503cc87a9
1 changed files with 5 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import requests
|
||||
import logging
|
||||
import os
|
||||
from konawall.custom_print import kv_print
|
||||
from konawall.custom_errors import RequestFailed
|
||||
from konawall.module_loader import add_source
|
||||
|
|
@ -13,6 +14,9 @@ Turn a list of tags and a count into a list of URLs to download from
|
|||
:returns: A list of URLs to download from
|
||||
"""
|
||||
def request_posts(count: int, tags: list, config) -> list:
|
||||
if "KONAWALL_E621_API_KEY" in os.environ:
|
||||
api_key = os.environ["KONAWALL_E621_API_KEY"]
|
||||
else:
|
||||
api_key = config["e621_api_key"]
|
||||
logging.debug(f"request_posts() called with count={count}, tags=[{', '.join(tags)}]")
|
||||
# Make sure we get a different result every time by using "order:random" as a tag
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue