Seems legit now

This commit is contained in:
Profitroll 2024-03-19 22:23:13 +01:00
parent e0fa508be0
commit 59759bd6f4
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2
5 changed files with 15 additions and 17 deletions

4
.gitignore vendored
View File

@ -153,8 +153,12 @@ cython_debug/
#.idea/ #.idea/
# Custom # Custom
cache/
config.json config.json
*.session *.session
*.session-wal
*.session-shm
*.session-journal *.session-journal
venv venv

View File

@ -179,7 +179,7 @@ class PyroClient(PyroClient):
response = await photo_upload( response = await photo_upload(
self.config["posting"]["api"]["album"], self.config["posting"]["api"]["album"],
client=client, client=client,
multipart_data=BodyPhotoUpload( body=BodyPhotoUpload(
File(media_bytes, filepath.name, "image/jpeg") File(media_bytes, filepath.name, "image/jpeg")
), ),
ignore_duplicates=self.config["submission"]["allow_duplicates"], ignore_duplicates=self.config["submission"]["allow_duplicates"],
@ -190,16 +190,14 @@ class PyroClient(PyroClient):
response = await video_upload( response = await video_upload(
self.config["posting"]["api"]["album"], self.config["posting"]["api"]["album"],
client=client, client=client,
multipart_data=BodyVideoUpload( body=BodyVideoUpload(File(media_bytes, filepath.name, "video/*")),
File(media_bytes, filepath.name, "video/*")
),
caption="queue", caption="queue",
) )
# elif db_entry["type"] == SubmissionType.ANIMATION.value: # elif db_entry["type"] == SubmissionType.ANIMATION.value:
# response = await video_upload( # response = await video_upload(
# self.config["posting"]["api"]["album"], # self.config["posting"]["api"]["album"],
# client=client, # client=client,
# multipart_data=BodyVideoUpload( # body=BodyVideoUpload(
# File(media_bytes, filepath.name, "video/*") # File(media_bytes, filepath.name, "video/*")
# ), # ),
# caption="queue", # caption="queue",

View File

@ -117,16 +117,14 @@ async def authorize(custom_session: Union[ClientSession, None] = None) -> str:
unauthorized_client = Client( unauthorized_client = Client(
base_url=sync.config_get("address", "posting", "api"), sync.config_get("address", "posting", "api"),
timeout=sync.config_get("timeout", "posting", "api"),
verify_ssl=True,
raise_on_unexpected_status=True, raise_on_unexpected_status=True,
follow_redirects=False, timeout=sync.config_get("timeout", "posting", "api"),
) )
login_token = login( login_token = login(
client=unauthorized_client, client=unauthorized_client,
form_data=BodyLoginForAccessTokenTokenPost( body=BodyLoginForAccessTokenTokenPost(
grant_type="password", grant_type="password",
scope="me albums.list albums.read albums.write photos.list photos.read photos.write videos.list videos.read videos.write", scope="me albums.list albums.read albums.write photos.list photos.read photos.write videos.list videos.read videos.write",
username=sync.config_get("username", "posting", "api"), username=sync.config_get("username", "posting", "api"),
@ -141,12 +139,10 @@ if not isinstance(login_token, Token):
exit() exit()
client = AuthenticatedClient( client = AuthenticatedClient(
base_url=sync.config_get("address", "posting", "api"), sync.config_get("address", "posting", "api"),
timeout=sync.config_get("timeout", "posting", "api"),
verify_ssl=True,
raise_on_unexpected_status=True,
token=login_token.access_token, token=login_token.access_token,
follow_redirects=False, raise_on_unexpected_status=True,
timeout=sync.config_get("timeout", "posting", "api"),
) )
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -158,7 +158,7 @@ async def cmd_import(app: PyroClient, message: Message):
uploaded = await photo_upload( uploaded = await photo_upload(
app.config["posting"]["api"]["album"], app.config["posting"]["api"]["album"],
client=client, client=client,
multipart_data=BodyPhotoUpload( body=BodyPhotoUpload(
File(photo_bytes, Path(filename).name, "image/jpeg") File(photo_bytes, Path(filename).name, "image/jpeg")
), ),
ignore_duplicates=app.config["submission"]["allow_duplicates"], ignore_duplicates=app.config["submission"]["allow_duplicates"],

View File

@ -4,7 +4,7 @@ pillow~=10.2.0
pykeyboard==0.1.7 pykeyboard==0.1.7
pytimeparse~=1.1.8 pytimeparse~=1.1.8
tgcrypto==1.2.5 tgcrypto==1.2.5
uvloop==0.19.0 #uvloop==0.19.0
--extra-index-url https://git.end-play.xyz/api/packages/profitroll/pypi/simple --extra-index-url https://git.end-play.xyz/api/packages/profitroll/pypi/simple
async_pymongo==0.1.4 async_pymongo==0.1.4
libbot[speed,pyrogram]==3.0.0 libbot[speed,pyrogram]==3.0.0