Skip to content

Commit

Permalink
Merge pull request #8 from xXxCLOTIxXx/temp
Browse files Browse the repository at this point in the history
Temp
  • Loading branch information
xXxCLOTIxXx authored Jun 9, 2024
2 parents b750b3f + 44047a2 commit 50d4dab
Show file tree
Hide file tree
Showing 19 changed files with 200 additions and 592 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__pycache__/
*.pyc
.vscode
2 changes: 1 addition & 1 deletion amino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
__author__ = 'Xsarz'
__license__ = 'MIT'
__copyright__ = 'Copyright 2024 Xsarz'
__version__ = '0.3'
__version__ = '0.4'
15 changes: 6 additions & 9 deletions amino/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .helpers.generator import generate_deviceId, sid_to_uid
from .helpers.exceptions import SpecifyType
from .ws.AsyncSocket import AsyncSocket
from .objects.reqObjects import UserProfile
from .objects.reqObjects import DynamicObject


from time import time as timestamp
Expand Down Expand Up @@ -44,7 +44,7 @@ def deviceId(self):



async def login(self, email: str, password: str = None, secret: str = None) -> UserProfile:
async def login(self, email: str, password: str = None, secret: str = None) -> DynamicObject:
if password is None and secret is None: raise SpecifyType
result = await self.req.request("POST", "/g/s/auth/login", {
"email": email,
Expand All @@ -53,16 +53,15 @@ async def login(self, email: str, password: str = None, secret: str = None) ->
"deviceID": self.deviceId,
"clientType": 100,
"action": "normal",
"timestamp": int(timestamp() * 1000)
})
self.req.profile.sid, self.req.profile.uid = result["sid"], result["auid"]
if self.socket_enable:
final = f"{self.deviceId}|{int(timestamp() * 1000)}"
await self.ws_connect(final=final, headers=self.ws_headers(self.sid, final, self.deviceId))
return UserProfile(result["userProfile"])
return result["userProfile"]


async def login_phone(self, phone: str, password: str = None, secret: str = None) -> UserProfile:
async def login_phone(self, phone: str, password: str = None, secret: str = None) -> DynamicObject:
if password is None and secret is None: raise SpecifyType
result = await self.req.request("POST", "/g/s/auth/login", {
"phoneNumber": phone,
Expand All @@ -71,13 +70,12 @@ async def login_phone(self, phone: str, password: str = None, secret: str = None
"deviceID": self.deviceId,
"clientType": 100,
"action": "normal",
"timestamp": int(timestamp() * 1000)
})
self.req.profile.sid, self.req.profile.uid = result["sid"], result["auid"]
if self.socket_enable:
final = f"{self.deviceId}|{int(timestamp() * 1000)}"
await self.ws_connect(final=final, headers=self.ws_headers(self.sid, final, self.deviceId))
return UserProfile(result["userProfile"])
return result["userProfile"]


async def login_sid(self, sid: str) -> auth_data:
Expand All @@ -89,11 +87,10 @@ async def login_sid(self, sid: str) -> auth_data:



async def logout(self) -> dict:
async def logout(self) -> DynamicObject:
result = await self.req.request("POST", "/g/s/auth/logout", {
"deviceID": self.profile.deviceId,
"clientType": 100,
"timestamp": int(timestamp() * 1000)
})
self.req.profile.sid, self.req.profile.uid = None, None
if self.socket_enable:await self.ws_disconnect()
Expand Down
4 changes: 3 additions & 1 deletion amino/async_community_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from .helpers.requests_builder import AsyncRequestsBuilder
from .helpers.generator import timezone

from .objects.reqObjects import DynamicObject


class AsyncCommunityClient:
req: AsyncRequestsBuilder
Expand Down Expand Up @@ -30,5 +32,5 @@ def deviceId(self):



async def check_in(self, tz: int = None) -> dict:
async def check_in(self, tz: int = None) -> DynamicObject:
return await self.req.request("POST", f"/x{self.comId}/s/check-in", { "timezone": tz if tz else timezone()})
Loading

0 comments on commit 50d4dab

Please sign in to comment.