universal-mcp-applications 0.1.32__py3-none-any.whl → 0.1.36rc2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- universal_mcp/applications/ahrefs/app.py +52 -198
- universal_mcp/applications/airtable/app.py +23 -122
- universal_mcp/applications/apollo/app.py +111 -464
- universal_mcp/applications/asana/app.py +417 -1567
- universal_mcp/applications/aws_s3/app.py +36 -103
- universal_mcp/applications/bill/app.py +546 -1957
- universal_mcp/applications/box/app.py +1068 -3981
- universal_mcp/applications/braze/app.py +364 -1430
- universal_mcp/applications/browser_use/app.py +2 -8
- universal_mcp/applications/cal_com_v2/app.py +207 -625
- universal_mcp/applications/calendly/app.py +61 -200
- universal_mcp/applications/canva/app.py +45 -110
- universal_mcp/applications/clickup/app.py +207 -674
- universal_mcp/applications/coda/app.py +146 -426
- universal_mcp/applications/confluence/app.py +310 -1098
- universal_mcp/applications/contentful/app.py +36 -151
- universal_mcp/applications/crustdata/app.py +28 -107
- universal_mcp/applications/dialpad/app.py +283 -756
- universal_mcp/applications/digitalocean/app.py +1766 -5777
- universal_mcp/applications/domain_checker/app.py +3 -54
- universal_mcp/applications/e2b/app.py +14 -64
- universal_mcp/applications/elevenlabs/app.py +9 -47
- universal_mcp/applications/exa/app.py +6 -17
- universal_mcp/applications/falai/app.py +24 -101
- universal_mcp/applications/figma/app.py +53 -137
- universal_mcp/applications/file_system/app.py +2 -13
- universal_mcp/applications/firecrawl/app.py +51 -152
- universal_mcp/applications/fireflies/app.py +59 -281
- universal_mcp/applications/fpl/app.py +91 -528
- universal_mcp/applications/fpl/utils/fixtures.py +15 -49
- universal_mcp/applications/fpl/utils/helper.py +25 -89
- universal_mcp/applications/fpl/utils/league_utils.py +20 -64
- universal_mcp/applications/ghost_content/app.py +52 -161
- universal_mcp/applications/github/app.py +19 -56
- universal_mcp/applications/gong/app.py +88 -248
- universal_mcp/applications/google_calendar/app.py +16 -68
- universal_mcp/applications/google_docs/app.py +85 -189
- universal_mcp/applications/google_drive/app.py +141 -463
- universal_mcp/applications/google_gemini/app.py +12 -64
- universal_mcp/applications/google_mail/app.py +28 -157
- universal_mcp/applications/google_searchconsole/app.py +15 -48
- universal_mcp/applications/google_sheet/app.py +100 -581
- universal_mcp/applications/google_sheet/helper.py +10 -37
- universal_mcp/applications/hashnode/app.py +57 -269
- universal_mcp/applications/heygen/app.py +44 -122
- universal_mcp/applications/http_tools/app.py +10 -32
- universal_mcp/applications/hubspot/api_segments/crm_api.py +460 -1573
- universal_mcp/applications/hubspot/api_segments/marketing_api.py +74 -262
- universal_mcp/applications/hubspot/app.py +23 -87
- universal_mcp/applications/jira/app.py +2071 -7986
- universal_mcp/applications/klaviyo/app.py +494 -1376
- universal_mcp/applications/linkedin/README.md +9 -2
- universal_mcp/applications/linkedin/app.py +240 -181
- universal_mcp/applications/mailchimp/app.py +450 -1605
- universal_mcp/applications/markitdown/app.py +8 -20
- universal_mcp/applications/miro/app.py +217 -699
- universal_mcp/applications/ms_teams/app.py +64 -186
- universal_mcp/applications/neon/app.py +86 -192
- universal_mcp/applications/notion/app.py +21 -36
- universal_mcp/applications/onedrive/app.py +16 -38
- universal_mcp/applications/openai/app.py +42 -165
- universal_mcp/applications/outlook/app.py +24 -84
- universal_mcp/applications/perplexity/app.py +4 -19
- universal_mcp/applications/pipedrive/app.py +832 -3142
- universal_mcp/applications/posthog/app.py +163 -432
- universal_mcp/applications/reddit/app.py +40 -139
- universal_mcp/applications/resend/app.py +41 -107
- universal_mcp/applications/retell/app.py +14 -41
- universal_mcp/applications/rocketlane/app.py +221 -934
- universal_mcp/applications/scraper/README.md +7 -4
- universal_mcp/applications/scraper/app.py +50 -109
- universal_mcp/applications/semanticscholar/app.py +22 -64
- universal_mcp/applications/semrush/app.py +43 -77
- universal_mcp/applications/sendgrid/app.py +512 -1262
- universal_mcp/applications/sentry/app.py +271 -906
- universal_mcp/applications/serpapi/app.py +40 -143
- universal_mcp/applications/sharepoint/app.py +17 -39
- universal_mcp/applications/shopify/app.py +1551 -4287
- universal_mcp/applications/shortcut/app.py +155 -417
- universal_mcp/applications/slack/app.py +33 -115
- universal_mcp/applications/spotify/app.py +126 -325
- universal_mcp/applications/supabase/app.py +104 -213
- universal_mcp/applications/tavily/app.py +1 -1
- universal_mcp/applications/trello/app.py +693 -2656
- universal_mcp/applications/twilio/app.py +14 -50
- universal_mcp/applications/twitter/api_segments/compliance_api.py +4 -14
- universal_mcp/applications/twitter/api_segments/dm_conversations_api.py +6 -18
- universal_mcp/applications/twitter/api_segments/likes_api.py +1 -3
- universal_mcp/applications/twitter/api_segments/lists_api.py +5 -15
- universal_mcp/applications/twitter/api_segments/trends_api.py +1 -3
- universal_mcp/applications/twitter/api_segments/tweets_api.py +9 -31
- universal_mcp/applications/twitter/api_segments/usage_api.py +1 -5
- universal_mcp/applications/twitter/api_segments/users_api.py +14 -42
- universal_mcp/applications/whatsapp/app.py +35 -186
- universal_mcp/applications/whatsapp/audio.py +2 -6
- universal_mcp/applications/whatsapp/whatsapp.py +17 -51
- universal_mcp/applications/whatsapp_business/app.py +70 -283
- universal_mcp/applications/wrike/app.py +45 -118
- universal_mcp/applications/yahoo_finance/app.py +19 -65
- universal_mcp/applications/youtube/app.py +75 -261
- universal_mcp/applications/zenquotes/app.py +2 -2
- {universal_mcp_applications-0.1.32.dist-info → universal_mcp_applications-0.1.36rc2.dist-info}/METADATA +2 -2
- {universal_mcp_applications-0.1.32.dist-info → universal_mcp_applications-0.1.36rc2.dist-info}/RECORD +105 -105
- {universal_mcp_applications-0.1.32.dist-info → universal_mcp_applications-0.1.36rc2.dist-info}/WHEEL +0 -0
- {universal_mcp_applications-0.1.32.dist-info → universal_mcp_applications-0.1.36rc2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from typing import Any
|
|
2
|
-
|
|
3
2
|
import httpx
|
|
4
3
|
from loguru import logger
|
|
5
4
|
from universal_mcp.applications.application import APIApplication
|
|
@@ -38,13 +37,9 @@ class RedditApp(APIApplication):
|
|
|
38
37
|
if "access_token" not in credentials:
|
|
39
38
|
logger.error("Reddit credentials found but missing 'access_token'.")
|
|
40
39
|
raise ValueError("Invalid Reddit credentials format.")
|
|
40
|
+
return {"Authorization": f"Bearer {credentials['access_token']}", "User-Agent": "agentr-reddit-app/0.1 by AgentR"}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
"Authorization": f"Bearer {credentials['access_token']}",
|
|
44
|
-
"User-Agent": "agentr-reddit-app/0.1 by AgentR",
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
def get_subreddit_posts(self, subreddit: str, limit: int = 5, timeframe: str = "day") -> dict[str, Any]:
|
|
42
|
+
async def get_subreddit_posts(self, subreddit: str, limit: int = 5, timeframe: str = "day") -> dict[str, Any]:
|
|
48
43
|
"""
|
|
49
44
|
Fetches a specified number of top-rated posts from a particular subreddit, allowing results to be filtered by a specific timeframe (e.g., 'day', 'week'). This is a simplified version compared to `get_subreddit_top_posts`, which uses more complex pagination parameters instead of a direct time filter.
|
|
50
45
|
|
|
@@ -74,7 +69,7 @@ class RedditApp(APIApplication):
|
|
|
74
69
|
response = self._get(url, params=params)
|
|
75
70
|
return self._handle_response(response)
|
|
76
71
|
|
|
77
|
-
def search_subreddits(self, query: str, limit: int = 5, sort: str = "relevance") -> dict[str, Any]:
|
|
72
|
+
async def search_subreddits(self, query: str, limit: int = 5, sort: str = "relevance") -> dict[str, Any]:
|
|
78
73
|
"""
|
|
79
74
|
Finds subreddits based on a query string, searching their names and descriptions.
|
|
80
75
|
Results can be sorted by relevance or activity. This function is for discovering communities and does not search for posts or users, unlike the more general `search_reddit` function.
|
|
@@ -100,16 +95,12 @@ class RedditApp(APIApplication):
|
|
|
100
95
|
if not 1 <= limit <= 100:
|
|
101
96
|
return f"Error: Invalid limit '{limit}'. Please use a value between 1 and 100."
|
|
102
97
|
url = f"{self.base_api_url}/subreddits/search"
|
|
103
|
-
params = {
|
|
104
|
-
"q": query,
|
|
105
|
-
"limit": limit,
|
|
106
|
-
"sort": sort,
|
|
107
|
-
}
|
|
98
|
+
params = {"q": query, "limit": limit, "sort": sort}
|
|
108
99
|
logger.info(f"Searching for subreddits matching '{query}' (limit: {limit}, sort: {sort})")
|
|
109
100
|
response = self._get(url, params=params)
|
|
110
101
|
return self._handle_response(response)
|
|
111
102
|
|
|
112
|
-
def get_post_flairs(self, subreddit: str):
|
|
103
|
+
async def get_post_flairs(self, subreddit: str):
|
|
113
104
|
"""
|
|
114
105
|
Fetches a list of available post flairs (tags) for a specified subreddit. This is primarily used to discover the correct `flair_id` needed to categorize a new submission when using the `create_post` function. It returns flair details or a message if none are available.
|
|
115
106
|
|
|
@@ -134,15 +125,7 @@ class RedditApp(APIApplication):
|
|
|
134
125
|
return f"No post flairs available for r/{subreddit}."
|
|
135
126
|
return flairs
|
|
136
127
|
|
|
137
|
-
def create_post(
|
|
138
|
-
self,
|
|
139
|
-
subreddit: str,
|
|
140
|
-
title: str,
|
|
141
|
-
kind: str = "self",
|
|
142
|
-
text: str = None,
|
|
143
|
-
url: str = None,
|
|
144
|
-
flair_id: str = None,
|
|
145
|
-
):
|
|
128
|
+
async def create_post(self, subreddit: str, title: str, kind: str = "self", text: str = None, url: str = None, flair_id: str = None):
|
|
146
129
|
"""
|
|
147
130
|
Creates a new Reddit post in a specified subreddit. It supports text ('self') or link posts, requiring a title and corresponding content (text or URL). An optional flair can be assigned. Returns the API response or a formatted error message on failure.
|
|
148
131
|
|
|
@@ -165,31 +148,24 @@ class RedditApp(APIApplication):
|
|
|
165
148
|
"""
|
|
166
149
|
if kind not in ["self", "link"]:
|
|
167
150
|
raise ValueError("Invalid post kind. Must be one of 'self' or 'link'.")
|
|
168
|
-
if kind == "self" and not text:
|
|
151
|
+
if kind == "self" and (not text):
|
|
169
152
|
raise ValueError("Text content is required for text posts.")
|
|
170
|
-
if kind == "link" and not url:
|
|
153
|
+
if kind == "link" and (not url):
|
|
171
154
|
raise ValueError("URL is required for link posts (including images).")
|
|
172
|
-
data = {
|
|
173
|
-
"sr": subreddit,
|
|
174
|
-
"title": title,
|
|
175
|
-
"kind": kind,
|
|
176
|
-
"text": text,
|
|
177
|
-
"url": url,
|
|
178
|
-
"flair_id": flair_id,
|
|
179
|
-
}
|
|
155
|
+
data = {"sr": subreddit, "title": title, "kind": kind, "text": text, "url": url, "flair_id": flair_id}
|
|
180
156
|
data = {k: v for k, v in data.items() if v is not None}
|
|
181
157
|
url_api = f"{self.base_api_url}/api/submit"
|
|
182
158
|
logger.info(f"Submitting a new post to r/{subreddit}")
|
|
183
159
|
response = self._post(url_api, data=data)
|
|
184
160
|
response_json = response.json()
|
|
185
|
-
if response_json and "json" in response_json and "errors" in response_json["json"]:
|
|
161
|
+
if response_json and "json" in response_json and ("errors" in response_json["json"]):
|
|
186
162
|
errors = response_json["json"]["errors"]
|
|
187
163
|
if errors:
|
|
188
164
|
error_message = ", ".join([f"{code}: {message}" for code, message in errors])
|
|
189
165
|
return f"Reddit API error: {error_message}"
|
|
190
166
|
return response_json
|
|
191
167
|
|
|
192
|
-
def get_comment_by_id(self, comment_id: str) -> dict:
|
|
168
|
+
async def get_comment_by_id(self, comment_id: str) -> dict:
|
|
193
169
|
"""
|
|
194
170
|
Retrieves a single Reddit comment's data, such as author and score, using its unique 't1_' prefixed ID. Unlike `get_post_comments_details` which fetches all comments for a post, this function targets one specific comment directly, returning an error dictionary if it is not found.
|
|
195
171
|
|
|
@@ -215,7 +191,7 @@ class RedditApp(APIApplication):
|
|
|
215
191
|
else:
|
|
216
192
|
return {"error": "Comment not found."}
|
|
217
193
|
|
|
218
|
-
def post_comment(self, parent_id: str, text: str) -> dict:
|
|
194
|
+
async def post_comment(self, parent_id: str, text: str) -> dict:
|
|
219
195
|
"""
|
|
220
196
|
Posts a new comment as a reply to a specified Reddit post or another comment. Using the parent's full ID and the desired text, it submits the comment via the API and returns the response containing the new comment's details.
|
|
221
197
|
|
|
@@ -234,15 +210,12 @@ class RedditApp(APIApplication):
|
|
|
234
210
|
post, comment, social, reddit, api, important
|
|
235
211
|
"""
|
|
236
212
|
url = f"{self.base_api_url}/api/comment"
|
|
237
|
-
data = {
|
|
238
|
-
"parent": parent_id,
|
|
239
|
-
"text": text,
|
|
240
|
-
}
|
|
213
|
+
data = {"parent": parent_id, "text": text}
|
|
241
214
|
logger.info(f"Posting comment to {parent_id}")
|
|
242
215
|
response = self._post(url, data=data)
|
|
243
216
|
return response.json()
|
|
244
217
|
|
|
245
|
-
def edit_content(self, content_id: str, text: str) -> dict:
|
|
218
|
+
async def edit_content(self, content_id: str, text: str) -> dict:
|
|
246
219
|
"""
|
|
247
220
|
Modifies the text of a specific Reddit post or comment via its unique ID. Unlike creation or deletion functions, this method specifically handles updates to existing user-generated content, submitting the new text to the API and returning a JSON response detailing the edited item.
|
|
248
221
|
|
|
@@ -261,15 +234,12 @@ class RedditApp(APIApplication):
|
|
|
261
234
|
edit, update, content, reddit, api, important
|
|
262
235
|
"""
|
|
263
236
|
url = f"{self.base_api_url}/api/editusertext"
|
|
264
|
-
data = {
|
|
265
|
-
"thing_id": content_id,
|
|
266
|
-
"text": text,
|
|
267
|
-
}
|
|
237
|
+
data = {"thing_id": content_id, "text": text}
|
|
268
238
|
logger.info(f"Editing content {content_id}")
|
|
269
239
|
response = self._post(url, data=data)
|
|
270
240
|
return response.json()
|
|
271
241
|
|
|
272
|
-
def delete_content(self, content_id: str) -> dict:
|
|
242
|
+
async def delete_content(self, content_id: str) -> dict:
|
|
273
243
|
"""
|
|
274
244
|
Deletes a specified Reddit post or comment using its full identifier (`content_id`). It sends a POST request to the `/api/del` endpoint for permanent removal, unlike `edit_content` which only modifies. On success, it returns a confirmation message.
|
|
275
245
|
|
|
@@ -287,15 +257,13 @@ class RedditApp(APIApplication):
|
|
|
287
257
|
delete, content-management, api, reddit, important
|
|
288
258
|
"""
|
|
289
259
|
url = f"{self.base_api_url}/api/del"
|
|
290
|
-
data = {
|
|
291
|
-
"id": content_id,
|
|
292
|
-
}
|
|
260
|
+
data = {"id": content_id}
|
|
293
261
|
logger.info(f"Deleting content {content_id}")
|
|
294
262
|
response = self._post(url, data=data)
|
|
295
263
|
response.raise_for_status()
|
|
296
264
|
return {"message": f"Content {content_id} deleted successfully."}
|
|
297
265
|
|
|
298
|
-
def get_current_user_info(self) -> Any:
|
|
266
|
+
async def get_current_user_info(self) -> Any:
|
|
299
267
|
"""
|
|
300
268
|
Retrieves the full profile information for the currently authenticated user by making a GET request to the `/api/v1/me` Reddit API endpoint. This differs from `get_user_profile`, which requires a username, and `get_current_user_karma`, which specifically fetches karma data.
|
|
301
269
|
|
|
@@ -311,7 +279,7 @@ class RedditApp(APIApplication):
|
|
|
311
279
|
response.raise_for_status()
|
|
312
280
|
return response.json()
|
|
313
281
|
|
|
314
|
-
def get_current_user_karma(self) -> Any:
|
|
282
|
+
async def get_current_user_karma(self) -> Any:
|
|
315
283
|
"""
|
|
316
284
|
Fetches the karma breakdown for the authenticated user from the Reddit API. This function specifically targets the `/api/v1/me/karma` endpoint, returning karma statistics per subreddit, which is more specific than `get_current_user_info` that retrieves general profile information.
|
|
317
285
|
|
|
@@ -327,7 +295,7 @@ class RedditApp(APIApplication):
|
|
|
327
295
|
response.raise_for_status()
|
|
328
296
|
return response.json()
|
|
329
297
|
|
|
330
|
-
def get_post_comments_details(self, post_id: str) -> Any:
|
|
298
|
+
async def get_post_comments_details(self, post_id: str) -> Any:
|
|
331
299
|
"""
|
|
332
300
|
Fetches a specific Reddit post's details and its complete comment tree using the post's unique ID. This function returns the entire discussion, including the original post and all associated comments, providing broader context than `get_comment_by_id` which only retrieves a single comment.
|
|
333
301
|
|
|
@@ -340,20 +308,13 @@ class RedditApp(APIApplication):
|
|
|
340
308
|
Tags:
|
|
341
309
|
listings, comments, posts, important
|
|
342
310
|
"""
|
|
343
|
-
|
|
344
311
|
url = f"{self.base_url}/comments/{post_id}.json"
|
|
345
312
|
query_params = {}
|
|
346
313
|
response = self._get(url, params=query_params)
|
|
347
314
|
return self._handle_response(response)
|
|
348
315
|
|
|
349
|
-
def get_controversial_posts(
|
|
350
|
-
self,
|
|
351
|
-
after: str = None,
|
|
352
|
-
before: str = None,
|
|
353
|
-
count: int = None,
|
|
354
|
-
limit: int = None,
|
|
355
|
-
show: str = None,
|
|
356
|
-
sr_detail: str = None,
|
|
316
|
+
async def get_controversial_posts(
|
|
317
|
+
self, after: str = None, before: str = None, count: int = None, limit: int = None, show: str = None, sr_detail: str = None
|
|
357
318
|
) -> Any:
|
|
358
319
|
"""
|
|
359
320
|
Fetches a global list of the most controversial posts from across all of Reddit, distinct from subreddit-specific queries. Optional parameters allow for pagination and customization of the results, returning the direct API response data with the post listings.
|
|
@@ -375,21 +336,14 @@ class RedditApp(APIApplication):
|
|
|
375
336
|
url = f"{self.base_url}/controversial"
|
|
376
337
|
query_params = {
|
|
377
338
|
k: v
|
|
378
|
-
for k, v in [
|
|
379
|
-
("after", after),
|
|
380
|
-
("before", before),
|
|
381
|
-
("count", count),
|
|
382
|
-
("limit", limit),
|
|
383
|
-
("show", show),
|
|
384
|
-
("sr_detail", sr_detail),
|
|
385
|
-
]
|
|
339
|
+
for k, v in [("after", after), ("before", before), ("count", count), ("limit", limit), ("show", show), ("sr_detail", sr_detail)]
|
|
386
340
|
if v is not None
|
|
387
341
|
}
|
|
388
342
|
response = self._get(url, params=query_params)
|
|
389
343
|
response.raise_for_status()
|
|
390
344
|
return response.json()
|
|
391
345
|
|
|
392
|
-
def get_hot_posts(
|
|
346
|
+
async def get_hot_posts(
|
|
393
347
|
self,
|
|
394
348
|
g: str = None,
|
|
395
349
|
after: str = None,
|
|
@@ -435,14 +389,8 @@ class RedditApp(APIApplication):
|
|
|
435
389
|
response.raise_for_status()
|
|
436
390
|
return response.json()
|
|
437
391
|
|
|
438
|
-
def get_new_posts(
|
|
439
|
-
self,
|
|
440
|
-
after: str = None,
|
|
441
|
-
before: str = None,
|
|
442
|
-
count: int = None,
|
|
443
|
-
limit: int = None,
|
|
444
|
-
show: str = None,
|
|
445
|
-
sr_detail: str = None,
|
|
392
|
+
async def get_new_posts(
|
|
393
|
+
self, after: str = None, before: str = None, count: int = None, limit: int = None, show: str = None, sr_detail: str = None
|
|
446
394
|
) -> Any:
|
|
447
395
|
"""
|
|
448
396
|
Fetches a list of the newest posts from across all of Reddit, not limited to a specific subreddit. This function supports optional pagination and filtering parameters to customize the API response, differentiating it from `get_subreddit_new_posts` which targets a single subreddit.
|
|
@@ -464,21 +412,14 @@ class RedditApp(APIApplication):
|
|
|
464
412
|
url = f"{self.base_url}/new"
|
|
465
413
|
query_params = {
|
|
466
414
|
k: v
|
|
467
|
-
for k, v in [
|
|
468
|
-
("after", after),
|
|
469
|
-
("before", before),
|
|
470
|
-
("count", count),
|
|
471
|
-
("limit", limit),
|
|
472
|
-
("show", show),
|
|
473
|
-
("sr_detail", sr_detail),
|
|
474
|
-
]
|
|
415
|
+
for k, v in [("after", after), ("before", before), ("count", count), ("limit", limit), ("show", show), ("sr_detail", sr_detail)]
|
|
475
416
|
if v is not None
|
|
476
417
|
}
|
|
477
418
|
response = self._get(url, params=query_params)
|
|
478
419
|
response.raise_for_status()
|
|
479
420
|
return response.json()
|
|
480
421
|
|
|
481
|
-
def get_subreddit_hot_posts(
|
|
422
|
+
async def get_subreddit_hot_posts(
|
|
482
423
|
self,
|
|
483
424
|
subreddit: str,
|
|
484
425
|
g: str = None,
|
|
@@ -528,7 +469,7 @@ class RedditApp(APIApplication):
|
|
|
528
469
|
response.raise_for_status()
|
|
529
470
|
return response.json()
|
|
530
471
|
|
|
531
|
-
def get_subreddit_new_posts(
|
|
472
|
+
async def get_subreddit_new_posts(
|
|
532
473
|
self,
|
|
533
474
|
subreddit: str,
|
|
534
475
|
after: str = None,
|
|
@@ -561,21 +502,14 @@ class RedditApp(APIApplication):
|
|
|
561
502
|
url = f"{self.base_url}/r/{subreddit}/new"
|
|
562
503
|
query_params = {
|
|
563
504
|
k: v
|
|
564
|
-
for k, v in [
|
|
565
|
-
("after", after),
|
|
566
|
-
("before", before),
|
|
567
|
-
("count", count),
|
|
568
|
-
("limit", limit),
|
|
569
|
-
("show", show),
|
|
570
|
-
("sr_detail", sr_detail),
|
|
571
|
-
]
|
|
505
|
+
for k, v in [("after", after), ("before", before), ("count", count), ("limit", limit), ("show", show), ("sr_detail", sr_detail)]
|
|
572
506
|
if v is not None
|
|
573
507
|
}
|
|
574
508
|
response = self._get(url, params=query_params)
|
|
575
509
|
response.raise_for_status()
|
|
576
510
|
return response.json()
|
|
577
511
|
|
|
578
|
-
def get_subreddit_top_posts(
|
|
512
|
+
async def get_subreddit_top_posts(
|
|
579
513
|
self,
|
|
580
514
|
subreddit: str,
|
|
581
515
|
after: str = None,
|
|
@@ -608,28 +542,15 @@ class RedditApp(APIApplication):
|
|
|
608
542
|
url = f"{self.base_url}/r/{subreddit}/top"
|
|
609
543
|
query_params = {
|
|
610
544
|
k: v
|
|
611
|
-
for k, v in [
|
|
612
|
-
("after", after),
|
|
613
|
-
("before", before),
|
|
614
|
-
("count", count),
|
|
615
|
-
("limit", limit),
|
|
616
|
-
("show", show),
|
|
617
|
-
("sr_detail", sr_detail),
|
|
618
|
-
]
|
|
545
|
+
for k, v in [("after", after), ("before", before), ("count", count), ("limit", limit), ("show", show), ("sr_detail", sr_detail)]
|
|
619
546
|
if v is not None
|
|
620
547
|
}
|
|
621
548
|
response = self._get(url, params=query_params)
|
|
622
549
|
response.raise_for_status()
|
|
623
550
|
return response.json()
|
|
624
551
|
|
|
625
|
-
def get_rising_posts(
|
|
626
|
-
self,
|
|
627
|
-
after: str = None,
|
|
628
|
-
before: str = None,
|
|
629
|
-
count: int = None,
|
|
630
|
-
limit: int = None,
|
|
631
|
-
show: str = None,
|
|
632
|
-
sr_detail: str = None,
|
|
552
|
+
async def get_rising_posts(
|
|
553
|
+
self, after: str = None, before: str = None, count: int = None, limit: int = None, show: str = None, sr_detail: str = None
|
|
633
554
|
) -> Any:
|
|
634
555
|
"""
|
|
635
556
|
Retrieves a list of rising posts from across all of Reddit. Unlike subreddit-specific listing functions (e.g., `get_subreddit_hot_posts`), this operates globally. It supports optional pagination and filtering parameters, such as `limit` and `after`, to customize the API response and navigate through results.
|
|
@@ -651,28 +572,15 @@ class RedditApp(APIApplication):
|
|
|
651
572
|
url = f"{self.base_url}/rising"
|
|
652
573
|
query_params = {
|
|
653
574
|
k: v
|
|
654
|
-
for k, v in [
|
|
655
|
-
("after", after),
|
|
656
|
-
("before", before),
|
|
657
|
-
("count", count),
|
|
658
|
-
("limit", limit),
|
|
659
|
-
("show", show),
|
|
660
|
-
("sr_detail", sr_detail),
|
|
661
|
-
]
|
|
575
|
+
for k, v in [("after", after), ("before", before), ("count", count), ("limit", limit), ("show", show), ("sr_detail", sr_detail)]
|
|
662
576
|
if v is not None
|
|
663
577
|
}
|
|
664
578
|
response = self._get(url, params=query_params)
|
|
665
579
|
response.raise_for_status()
|
|
666
580
|
return response.json()
|
|
667
581
|
|
|
668
|
-
def get_top_posts(
|
|
669
|
-
self,
|
|
670
|
-
after: str = None,
|
|
671
|
-
before: str = None,
|
|
672
|
-
count: int = None,
|
|
673
|
-
limit: int = None,
|
|
674
|
-
show: str = None,
|
|
675
|
-
sr_detail: str = None,
|
|
582
|
+
async def get_top_posts(
|
|
583
|
+
self, after: str = None, before: str = None, count: int = None, limit: int = None, show: str = None, sr_detail: str = None
|
|
676
584
|
) -> Any:
|
|
677
585
|
"""
|
|
678
586
|
Fetches top-rated posts from across all of Reddit, distinct from `get_subreddit_top_posts`, which operates on a specific subreddit. The function supports standard API pagination parameters like `limit`, `after`, and `before` to navigate results, providing a broad, site-wide view of top content.
|
|
@@ -694,21 +602,14 @@ class RedditApp(APIApplication):
|
|
|
694
602
|
url = f"{self.base_url}/top"
|
|
695
603
|
query_params = {
|
|
696
604
|
k: v
|
|
697
|
-
for k, v in [
|
|
698
|
-
("after", after),
|
|
699
|
-
("before", before),
|
|
700
|
-
("count", count),
|
|
701
|
-
("limit", limit),
|
|
702
|
-
("show", show),
|
|
703
|
-
("sr_detail", sr_detail),
|
|
704
|
-
]
|
|
605
|
+
for k, v in [("after", after), ("before", before), ("count", count), ("limit", limit), ("show", show), ("sr_detail", sr_detail)]
|
|
705
606
|
if v is not None
|
|
706
607
|
}
|
|
707
608
|
response = self._get(url, params=query_params)
|
|
708
609
|
response.raise_for_status()
|
|
709
610
|
return response.json()
|
|
710
611
|
|
|
711
|
-
def search_reddit(
|
|
612
|
+
async def search_reddit(
|
|
712
613
|
self,
|
|
713
614
|
after: str = None,
|
|
714
615
|
before: str = None,
|
|
@@ -772,7 +673,7 @@ class RedditApp(APIApplication):
|
|
|
772
673
|
response.raise_for_status()
|
|
773
674
|
return response.json()
|
|
774
675
|
|
|
775
|
-
def get_user_profile(self, username: str) -> Any:
|
|
676
|
+
async def get_user_profile(self, username: str) -> Any:
|
|
776
677
|
"""
|
|
777
678
|
Retrieves public profile information for a specified Reddit user via the `/user/{username}/about` endpoint. Unlike `get_current_user_info`, which targets the authenticated user, this function fetches data like karma and account age for any user identified by their username.
|
|
778
679
|
|