From 1ac5abd7bf29eb95b51bbdd3aa375e77a5883e88 Mon Sep 17 00:00:00 2001 From: Renovate Date: Tue, 19 Mar 2024 23:25:03 +0200 Subject: [PATCH] Update dependency photosapi_client to v0.6.0 (#75) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Update | Change | |---|---|---| | photosapi_client | minor | `==0.5.0` -> `==0.6.0` | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Co-authored-by: profitroll Reviewed-on: https://git.end-play.xyz/profitroll/TelegramPoster/pulls/75 Co-authored-by: Renovate Co-committed-by: Renovate --- .gitignore | 4 ++++ classes/pyroclient.py | 8 +++----- modules/api_client.py | 16 ++++++---------- plugins/commands/photos.py | 2 +- requirements.txt | 4 ++-- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index b4a0707..d353d48 100644 --- a/.gitignore +++ b/.gitignore @@ -153,8 +153,12 @@ cython_debug/ #.idea/ # Custom +cache/ config.json + *.session +*.session-wal +*.session-shm *.session-journal venv diff --git a/classes/pyroclient.py b/classes/pyroclient.py index ebab94a..6bca93c 100644 --- a/classes/pyroclient.py +++ b/classes/pyroclient.py @@ -179,7 +179,7 @@ class PyroClient(PyroClient): response = await photo_upload( self.config["posting"]["api"]["album"], client=client, - multipart_data=BodyPhotoUpload( + body=BodyPhotoUpload( File(media_bytes, filepath.name, "image/jpeg") ), ignore_duplicates=self.config["submission"]["allow_duplicates"], @@ -190,16 +190,14 @@ class PyroClient(PyroClient): response = await video_upload( self.config["posting"]["api"]["album"], client=client, - multipart_data=BodyVideoUpload( - File(media_bytes, filepath.name, "video/*") - ), + body=BodyVideoUpload(File(media_bytes, filepath.name, "video/*")), caption="queue", ) # elif db_entry["type"] == SubmissionType.ANIMATION.value: # response = await video_upload( # self.config["posting"]["api"]["album"], # client=client, - # multipart_data=BodyVideoUpload( + # body=BodyVideoUpload( # File(media_bytes, filepath.name, "video/*") # ), # caption="queue", diff --git a/modules/api_client.py b/modules/api_client.py index d9fa113..f2061b4 100644 --- a/modules/api_client.py +++ b/modules/api_client.py @@ -117,16 +117,14 @@ async def authorize(custom_session: Union[ClientSession, None] = None) -> str: unauthorized_client = Client( - base_url=sync.config_get("address", "posting", "api"), - timeout=sync.config_get("timeout", "posting", "api"), - verify_ssl=True, + sync.config_get("address", "posting", "api"), raise_on_unexpected_status=True, - follow_redirects=False, + timeout=sync.config_get("timeout", "posting", "api"), ) login_token = login( client=unauthorized_client, - form_data=BodyLoginForAccessTokenTokenPost( + body=BodyLoginForAccessTokenTokenPost( grant_type="password", 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"), @@ -141,12 +139,10 @@ if not isinstance(login_token, Token): exit() client = AuthenticatedClient( - base_url=sync.config_get("address", "posting", "api"), - timeout=sync.config_get("timeout", "posting", "api"), - verify_ssl=True, - raise_on_unexpected_status=True, + sync.config_get("address", "posting", "api"), token=login_token.access_token, - follow_redirects=False, + raise_on_unexpected_status=True, + timeout=sync.config_get("timeout", "posting", "api"), ) if __name__ == "__main__": diff --git a/plugins/commands/photos.py b/plugins/commands/photos.py index 189b986..423e170 100644 --- a/plugins/commands/photos.py +++ b/plugins/commands/photos.py @@ -158,7 +158,7 @@ async def cmd_import(app: PyroClient, message: Message): uploaded = await photo_upload( app.config["posting"]["api"]["album"], client=client, - multipart_data=BodyPhotoUpload( + body=BodyPhotoUpload( File(photo_bytes, Path(filename).name, "image/jpeg") ), ignore_duplicates=app.config["submission"]["allow_duplicates"], diff --git a/requirements.txt b/requirements.txt index d16b7c7..142ad2f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,8 +4,8 @@ pillow~=10.2.0 pykeyboard==0.1.7 pytimeparse~=1.1.8 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 async_pymongo==0.1.4 libbot[speed,pyrogram]==3.0.0 -photosapi_client==0.5.0 \ No newline at end of file +photosapi_client==0.6.0 \ No newline at end of file