GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — clean up 2Captcha · isfans2020/cloudscraper@b5b4dec

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • cloudscraper/captcha
    • 2captcha.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎cloudscraper/captcha/2captcha.py‎

Copy file name to clipboardExpand all lines: cloudscraper/captcha/2captcha.py
+10-11Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import absolute_import
22

3-
from pprint import pprint
43
import requests
54
try:
65
from urlparse import urlparse
@@ -139,7 +138,6 @@ def requestJob(self, jobID):
139138
raise CaptchaBadJobID("2Captcha: Error bad job id to request Captcha.")
140139

141140
def _checkRequest(response):
142-
pprint(response.text)
143141
if response.ok and response.json().get('status') == 1:
144142
return response
145143

@@ -174,7 +172,6 @@ def _checkRequest(response):
174172

175173
def requestSolve(self, captchaType, url, siteKey):
176174
def _checkRequest(response):
177-
pprint(response.text)
178175
if response.ok and response.json().get("status") == 1 and response.json().get('request'):
179176
return response
180177

@@ -186,9 +183,7 @@ def _checkRequest(response):
186183
'key': self.api_key,
187184
'pageurl': url,
188185
'json': 1,
189-
'soft_id': 5507698,
190-
'proxy': self.proxy,
191-
'proxytype': self.proxyType
186+
'soft_id': 5507698
192187
}
193188

194189
data.update(
@@ -200,7 +195,14 @@ def _checkRequest(response):
200195
'sitekey': siteKey
201196
}
202197
)
203-
pprint(data)
198+
199+
if self.proxy:
200+
data.update(
201+
{
202+
'proxy': self.proxy,
203+
'proxytype': self.proxyType
204+
}
205+
)
204206

205207
response = polling.poll(
206208
lambda: self.session.post(
@@ -245,10 +247,7 @@ def getCaptchaAnswer(self, captchaType, url, siteKey, captchaParams):
245247
self.proxyType = hostParsed.scheme
246248
self.proxy = hostParsed.netloc
247249
else:
248-
if captchaType == 'hCaptcha':
249-
raise CaptchaParameter(
250-
"2Captcha: Cannot find set proxy to pass through to provider."
251-
)
250+
self.proxy = None
252251

253252
try:
254253
jobID = self.requestSolve(captchaType, url, siteKey)

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.