Skip to content

Commit 2814c5b

Browse files
committed
Fix mypy error from reused response variable in createTaskSmee
Rename second assignment to create_response to avoid type conflict with the Response object from the initial HEAD request. https://claude.ai/code/session_01NzfYD4hhH5nqhu8mgnMXPt
1 parent 2fdf8e6 commit 2814c5b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

python_anticaptcha/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,21 +215,21 @@ def createTaskSmee(self, task: BaseTask, timeout: int = MAXIMUM_JOIN_TIME) -> Jo
215215
stream=True,
216216
timeout=(self.response_timeout, timeout),
217217
)
218-
response = self.session.post(
218+
create_response = self.session.post(
219219
url=urljoin(self.base_url, self.CREATE_TASK_URL),
220220
json=request,
221221
timeout=self.response_timeout,
222222
).json()
223-
self._check_response(response)
223+
self._check_response(create_response)
224224
for line in r.iter_lines():
225225
content = line.decode("utf-8")
226226
if '"host":"smee.io"' not in content:
227227
continue
228228
payload = json.loads(content.split(":", maxsplit=1)[1].strip())
229-
if "taskId" not in payload["body"] or str(payload["body"]["taskId"]) != str(response["taskId"]):
229+
if "taskId" not in payload["body"] or str(payload["body"]["taskId"]) != str(create_response["taskId"]):
230230
continue
231231
r.close()
232-
job = Job(client=self, task_id=response["taskId"])
232+
job = Job(client=self, task_id=create_response["taskId"])
233233
job._last_result = payload["body"]
234234
return job
235235
raise AnticaptchaException(None, 250, "No matching task response received from smee.io")

0 commit comments

Comments
 (0)