From 91eb0fb7f52bab1325833bca79459812c35e6f65 Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Tue, 6 Jan 2026 11:35:19 -0500 Subject: [PATCH] Add def to get modqueue --- booru_utils.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/booru_utils.py b/booru_utils.py index 163742f..8e904c2 100644 --- a/booru_utils.py +++ b/booru_utils.py @@ -579,3 +579,39 @@ def delete_post(post_id, danbooru_url, api_key, username, reason=""): except Exception as e: print(f"Exception during deletion: {e}") return False + + +def fetch_modqueue(danbooru_url, api_key, username, limit=100): + """ + Fetches posts from the modqueue (pending or flagged posts). + + Args: + danbooru_url (str): The base URL of the booru + api_key (str): The API key for authentication + username (str): The username for authentication + limit (int): Maximum number of posts to fetch + + Returns: + list: List of posts in the modqueue + """ + url = f"{danbooru_url}/posts.json" + params = { + "tags": "status:pending OR status:flagged", + "limit": limit, + "login": username, + "api_key": api_key, + } + + try: + response = requests.get(url, params=params) + if response.status_code == 200: + posts = response.json() + print(f"Found {len(posts)} posts in modqueue") + return posts + else: + print(f"Failed to fetch modqueue. Status code: {response.status_code}") + print(f"Response: {response.text}") + return [] + except Exception as e: + print(f"Exception fetching modqueue: {e}") + return []