Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions twocaptcha/async_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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):
Expand Down
13 changes: 6 additions & 7 deletions twocaptcha/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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):
Expand Down