ad-m / python-anticaptcha

Client library for solve captchas with Anticaptcha.com support.
http://python-anticaptcha.readthedocs.io/en/latest/
MIT License
219 stars 51 forks source link

correct syntax / example for hCaptcha proxy #78

Closed VeNoMouS closed 3 years ago

VeNoMouS commented 3 years ago

@ad-m can you please supply a working example of how to pass proxy for hCaptcha?

ad-m commented 3 years ago

Yes, do you need it now or it can wait until weekend?

VeNoMouS commented 3 years ago

if possible now, im trying to rewrite cloudscraper to support it , ive already moved the other providers.

ad-m commented 3 years ago

In about 8 hours I will be able to take care of this at the earliest.

VeNoMouS commented 3 years ago

Does the code itself not support proxy , as i dont see how it would or am i reading it completely wrong.

ad-m commented 3 years ago

We have support for hCaptcha proxy. It have to be something like:

def parse_url(url):
    parsed = urlparse(url)
    return dict(
        proxy_type=parsed.scheme,
        proxy_address=parsed.hostname,
        proxy_port=parsed.port,
        proxy_login=parsed.username,
        proxy_password=parsed.password,
    )

proxy = parse_url(proxy_url)
task = HCaptchaTask(website_url=url, website_key=site_key, proxy=proxy)
job = client.createTask(task)
job.join()
return job.get_solution_response()

I can not test that snippet of code right now.

VeNoMouS commented 3 years ago

yea i wrote something like that, except ...

  File "/usr/local/lib/python3.7/dist-packages/python_anticaptcha/tasks.py", line 12, in __init__
    self.proxyType = kwargs.pop("proxy_type")
KeyError: 'proxy_type'
ad-m commented 3 years ago

I added example for HCaptcha: https://github.com/ad-m/python-anticaptcha/blob/master/examples/hcaptcha_request_proxy.py I included that example in e2e tests: https://github.com/ad-m/python-anticaptcha/blob/master/tests/test_examples.py#L134-L141

ad-m commented 3 years ago

@VeNoMouS, can I help you somehow?

VeNoMouS commented 3 years ago

nah mate sorry its all good, its sorted