Skip to content

Commit bddb5b2

Browse files
author
Andrei
committed
Refactor examples
1 parent 171771c commit bddb5b2

File tree

5 files changed

+28
-19
lines changed

5 files changed

+28
-19
lines changed

anticaptcha_examples/anticaptcah_image_to_text_example.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@
2525

2626
result = ImageToTextTask.ImageToTextTask(
2727
anticaptcha_key=ANTICAPTCHA_KEY, save_format="const"
28-
).captcha_handler(captcha_link="http://85.255.8.26/static/image/common_image_example/800070.png")
28+
).captcha_handler(
29+
captcha_link="https://pythoncaptcha.cloud/static/image/common_image_example/800070.png"
30+
)
2931
print(result)
3032

3133
# Пример который показывает работу антикапчи при решении капчи-изображением и сохранением её в качестве ВРЕМЕННОГО файла
3234
# Протестировано на Линуксах. Не используйте данный вариант на Windows! Возможно починим, но потом.
3335
# Example for working with captcha-image like a temporary file. Tested on UNIX-based systems. Don`t use it on Windows!
3436
result = ImageToTextTask.ImageToTextTask(anticaptcha_key=ANTICAPTCHA_KEY).captcha_handler(
35-
captcha_link="http://85.255.8.26/static/image/common_image_example/800070.png"
37+
captcha_link="https://pythoncaptcha.cloud/static/image/common_image_example/800070.png"
3638
)
3739
print(result)
3840

@@ -43,7 +45,9 @@
4345
An example of working with decoding in base64 captcha-file after download. On-the-fly-encoding
4446
"""
4547
base_64_link = base64.b64encode(
46-
requests.get("http://85.255.8.26/static/image/common_image_example/862963.png").content
48+
requests.get(
49+
"https://pythoncaptcha.cloud/static/image/common_image_example/862963.png"
50+
).content
4751
).decode("utf-8")
4852

4953
user_answer_base64 = ImageToTextTask.ImageToTextTask(
@@ -103,7 +107,7 @@ async def run():
103107
resolve = await ImageToTextTask.aioImageToTextTask(
104108
anticaptcha_key=ANTICAPTCHA_KEY, save_format="const"
105109
).captcha_handler(
106-
captcha_link="http://85.255.8.26/static/image/common_image_example/800070.png"
110+
captcha_link="https://pythoncaptcha.cloud/static/image/common_image_example/800070.png"
107111
)
108112

109113
print(resolve)
@@ -144,17 +148,18 @@ async def run():
144148
"""
145149

146150
answer = requests.post(
147-
"http://85.255.8.26:8001/register_key", json={"key": QUEUE_KEY, "vhost": "anticaptcha_vhost"}
151+
"https://pythoncaptcha.cloud:8001/register_key",
152+
json={"key": QUEUE_KEY, "vhost": "anticaptcha_vhost"},
148153
)
149154
# если очередь успешно создана:
150155
if answer == "OK":
151156

152157
# создаём задание с callbackURL параметром
153158
result = ImageToTextTask.ImageToTextTask(
154159
anticaptcha_key=ANTICAPTCHA_KEY,
155-
callbackUrl=f"http://85.255.8.26:8001/anticaptcha/image_to_text/{QUEUE_KEY}",
160+
callbackUrl=f"https://pythoncaptcha.cloud:8001/anticaptcha/image_to_text/{QUEUE_KEY}",
156161
).captcha_handler(
157-
captcha_link="http://85.255.8.26/static/image/common_image_example/800070.png"
162+
captcha_link="https://pythoncaptcha.cloud/static/image/common_image_example/800070.png"
158163
)
159164
print(result)
160165

anticaptcha_examples/anticaptcha_fun_example.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ async def run():
7070
"""
7171

7272
answer = requests.post(
73-
"http://85.255.8.26:8001/register_key", json={"key": QUEUE_KEY, "vhost": "anticaptcha_vhost"}
73+
"https://pythoncaptcha.cloud:8001/register_key",
74+
json={"key": QUEUE_KEY, "vhost": "anticaptcha_vhost"},
7475
)
7576
# если очередь успешно создана:
7677
if answer == "OK":
@@ -83,7 +84,7 @@ async def run():
8384
proxyPort=8080,
8485
proxyLogin="proxyLoginHere",
8586
proxyPassword="proxyPasswordHere",
86-
callbackUrl=f"http://85.255.8.26:8001/anticaptcha/fun_captcha/{QUEUE_KEY}",
87+
callbackUrl=f"https://pythoncaptcha.cloud:8001/anticaptcha/fun_captcha/{QUEUE_KEY}",
8788
).captcha_handler(websiteURL=WEB_URL, websitePublicKey=SITE_KEY)
8889
print(result)
8990

@@ -99,7 +100,7 @@ async def run():
99100
# создаём задание с callbackURL параметром
100101
result = FunCaptchaTaskProxyless.FunCaptchaTaskProxyless(
101102
anticaptcha_key=ANTICAPTCHA_KEY,
102-
callbackUrl=f"http://85.255.8.26:8001/anticaptcha/fun_captcha/{QUEUE_KEY}",
103+
callbackUrl=f"https://pythoncaptcha.cloud:8001/anticaptcha/fun_captcha/{QUEUE_KEY}",
103104
).captcha_handler(websiteURL=WEB_URL, websitePublicKey=SITE_KEY)
104105
print(result)
105106

anticaptcha_examples/anticaptcha_nocaptcha_example.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ async def run():
7373
"""
7474

7575
answer = requests.post(
76-
"http://85.255.8.26:8001/register_key", json={"key": QUEUE_KEY, "vhost": "anticaptcha_vhost"}
76+
"https://pythoncaptcha.cloud:8001/register_key",
77+
json={"key": QUEUE_KEY, "vhost": "anticaptcha_vhost"},
7778
)
7879
# если очередь успешно создана:
7980
if answer == "OK":
@@ -85,7 +86,7 @@ async def run():
8586
proxyPort=8080,
8687
proxyLogin="proxyLoginHere",
8788
proxyPassword="proxyPasswordHere",
88-
callbackUrl=f"http://85.255.8.26:8001/anticaptcha/nocaptcha/{QUEUE_KEY}",
89+
callbackUrl=f"https://pythoncaptcha.cloud:8001/anticaptcha/nocaptcha/{QUEUE_KEY}",
8990
).captcha_handler(
9091
websiteURL="https://www.google.com/recaptcha/api2/demo",
9192
websiteKey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",

anticaptcha_examples/anticaptcha_square_net_task.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,15 @@ async def run():
5757
"""
5858

5959
answer = requests.post(
60-
"http://85.255.8.26:8001/register_key", json={"key": QUEUE_KEY, "vhost": "anticaptcha_vhost"}
60+
"https://pythoncaptcha.cloud:8001/register_key",
61+
json={"key": QUEUE_KEY, "vhost": "anticaptcha_vhost"},
6162
)
6263
# если очередь успешно создана:
6364
if answer == "OK":
6465
# создаём задание с callbackURL параметром
6566
result = SquareNetTextTask.SquareNetTextTask(
6667
anticaptcha_key=ANTICAPTCHA_KEY,
67-
callbackUrl=f"http://85.255.8.26:8001/anticaptcha/fun_captcha/{QUEUE_KEY}",
68+
callbackUrl=f"https://pythoncaptcha.cloud:8001/anticaptcha/fun_captcha/{QUEUE_KEY}",
6869
).captcha_handler(
6970
objectName="captcha numbers",
7071
rowsCount=2,

anticaptcha_examples/callback_examples.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"""
2828

2929
answer = requests.post(
30-
"http://85.255.8.26:8001/register_key", json={"key": QUEUE_KEY, "vhost": "anticaptcha_vhost"}
30+
"https://pythoncaptcha.cloud:8001/register_key",
31+
json={"key": QUEUE_KEY, "vhost": "anticaptcha_vhost"},
3132
)
3233
# если очередь успешно создана:
3334
if answer == "OK":
@@ -36,7 +37,7 @@
3637
# Это метод для работы без прокси
3738
result = NoCaptchaTaskProxyless.NoCaptchaTaskProxyless(
3839
anticaptcha_key=ANTICAPTCHA_KEY,
39-
callbackUrl=f"http://85.255.8.26:8001/anticaptcha/nocaptcha/{QUEUE_KEY}",
40+
callbackUrl=f"https://pythoncaptcha.cloud:8001/anticaptcha/nocaptcha/{QUEUE_KEY}",
4041
).captcha_handler(
4142
websiteURL="https://www.google.com/recaptcha/api2/demo",
4243
websiteKey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
@@ -52,11 +53,11 @@
5253
).captcha_handler(
5354
requests_timeout=0.5,
5455
auth_params={
55-
"host": "85.255.8.26",
56+
"host": "https://pythoncaptcha.cloud/",
5657
"port": "8001",
5758
"rtmq_username": "hardworker_1",
5859
"rtmq_password": "password",
59-
"rtmq_host": "85.255.8.26",
60+
"rtmq_host": "https://pythoncaptcha.cloud/",
6061
"rtmq_port": "5672",
6162
"rtmq_vhost": "anticaptcha_vhost",
6263
},
@@ -68,7 +69,7 @@ async def run():
6869
try:
6970
result = await NoCaptchaTaskProxyless.aioNoCaptchaTaskProxyless(
7071
anticaptcha_key=ANTICAPTCHA_KEY,
71-
callbackUrl=f"http://85.255.8.26:8001/anticaptcha/nocaptcha/{QUEUE_KEY}",
72+
callbackUrl=f"https://pythoncaptcha.cloud:8001/anticaptcha/nocaptcha/{QUEUE_KEY}",
7273
).captcha_handler(
7374
websiteURL="https://www.google.com/recaptcha/api2/demo",
7475
websiteKey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",

0 commit comments

Comments
 (0)