From 5bc88ffa206fc77586b0ff6b771ccaeec0d3292e Mon Sep 17 00:00:00 2001 From: Maxim S Date: Mon, 20 Jul 2026 16:40:42 +0200 Subject: [PATCH] fix rotate method for base64 --- README.md | 2 +- twocaptcha/async_solver.py | 13 ++++++------- twocaptcha/solver.py | 13 ++++++------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index cf6bb68..86fbb21 100644 --- a/README.md +++ b/README.md @@ -380,7 +380,7 @@ result = solver.coordinates('path/to/captcha.jpg', param1=..., ...) This method can be used to solve a captcha that asks to rotate an object. It is mostly used to bypass FunCaptcha. Returns the rotation angle. ```python -result = solver.rotate('path/to/captcha.jpg', param1=..., ...) +result = solver.rotate('path/to/captcha.jpg' or 'base64', param1=..., ...) ``` ### MTCaptcha diff --git a/twocaptcha/async_solver.py b/twocaptcha/async_solver.py index e0d3142..486d1f7 100644 --- a/twocaptcha/async_solver.py +++ b/twocaptcha/async_solver.py @@ -508,10 +508,9 @@ async def rotate(self, files, **kwargs): Parameters __________ - files : file - Captcha image file. * required if you submit image as a file (method=post). - body : str - Base64-encoded captcha image. * required if you submit image as Base64-encoded string (method=base64). + files : file or str + Captcha image file (method=post), or a Base64-encoded captcha image string (method=base64) passed + directly as this same argument. angle : int, optional Angle for one rotation step in degrees. If not defined we'll use the default value for FunCaptcha: 40 degrees. Default: 40. @@ -532,10 +531,10 @@ async def rotate(self, files, **kwargs): ''' if isinstance(files, str): - file = await self.get_method(files) - file = file.get('file') + payload = await self.get_method(files) + payload.pop('method', None) - result = await self.solve(file=file, method='rotatecaptcha', **kwargs) + result = await self.solve(method='rotatecaptcha', **payload, **kwargs) return result elif isinstance(files, dict): diff --git a/twocaptcha/solver.py b/twocaptcha/solver.py index 191abb5..2410d73 100755 --- a/twocaptcha/solver.py +++ b/twocaptcha/solver.py @@ -654,10 +654,9 @@ def rotate(self, files, **kwargs): Parameters __________ - files : file - Captcha image file. * required if you submit image as a file (method=post). - body : str - Base64-encoded captcha image. * required if you submit image as Base64-encoded string (method=base64). + files : file or str + Captcha image file (method=post), or a Base64-encoded captcha image string (method=base64) passed + directly as this same argument. angle : int, optional Angle for one rotation step in degrees. If not defined we'll use the default value for FunCaptcha: 40 degrees. Default: 40. @@ -678,10 +677,10 @@ def rotate(self, files, **kwargs): ''' if isinstance(files, str): + payload = self.get_method(files) + payload.pop('method', None) - file = self.get_method(files)['file'] - - result = self.solve(file=file, method='rotatecaptcha', **kwargs) + result = self.solve(method='rotatecaptcha', **payload, **kwargs) return result elif isinstance(files, dict):