diff --git a/dist/devranta-1.0.0-py3-none-any.whl b/dist/devranta-1.0.0-py3-none-any.whl index 991dda9..ff6f939 100644 Binary files a/dist/devranta-1.0.0-py3-none-any.whl and b/dist/devranta-1.0.0-py3-none-any.whl differ diff --git a/dist/devranta-1.0.0.tar.gz b/dist/devranta-1.0.0.tar.gz index 16cd308..cd76c72 100644 Binary files a/dist/devranta-1.0.0.tar.gz and b/dist/devranta-1.0.0.tar.gz differ diff --git a/src/devranta/api.py b/src/devranta/api.py index 3b314fc..0e1b876 100644 --- a/src/devranta/api.py +++ b/src/devranta/api.py @@ -15,8 +15,6 @@ class Api: self.token_Key = None self.session = None - - def patch_auth(self, request_dict=None): auth_dict = {"app": self.app_id} if self.auth: @@ -70,7 +68,7 @@ class Api: async def get_comments_from_user(self, username): user_id = await self.get_user_id(username) profile = await self.get_profile(user_id) - return profile.get('content',{}).get('content',{}).get('comments',[]) + return profile.get("content", {}).get("content", {}).get("comments", []) async def post_comment(self, rant_id, comment): response = None @@ -92,7 +90,6 @@ class Api: ) obj = await response.json() - print(obj) if not obj.get("success"): return None @@ -140,7 +137,6 @@ class Api: if not obj.get("success"): return return obj.get("rants", []) - async def get_user_id(self, username): response = None @@ -156,7 +152,20 @@ class Api: @property async def mentions(self): - return [notif for notif in (await self.notifs) if notif['type'] == "comment_mention"] + return [ + notif for notif in (await self.notifs) if notif["type"] == "comment_mention" + ] + + async def update_comment(self, comment_id, comment): + response = None + if not await self.ensure_login(): + return None + async with self as session: + response = await session.get( + url=self.patch_url(f"comments/{comment_id}"), + data=self.patch_auth({"comment": comment}), + ) + return await response.get("success", False) @property async def notifs(self): @@ -168,4 +177,3 @@ class Api: url=self.patch_url("users/me/notif-feed"), params=self.patch_auth() ) return (await response.json()).get("data", {}).get("items", []) -