Skip to content

Commit a57e13e

Browse files
author
nextcaptcha
committed
session connection
1 parent b69eae8 commit a57e13e

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,5 @@ cython_debug/
157157
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158158
# and can be added to the global gitignore or merged into this file. For a more nuclear
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160-
.idea/
160+
.idea/
161+
test.py

nextcaptcha/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44

55

6-
__version__ = '1.0.6'
6+
__version__ = '1.0.7'

nextcaptcha/next.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22
import time
3-
3+
from urllib3.util.retry import Retry
4+
from requests.adapters import HTTPAdapter
45
import requests
56

67
logging.basicConfig(level=logging.INFO)
@@ -39,6 +40,14 @@ def __init__(self, client_key: str, solft_id: str, callback_url: str, open_log:
3940
self.open_log = open_log
4041
self.session = requests.session()
4142

43+
44+
adapter = HTTPAdapter(pool_connections=1000, pool_maxsize=1000)
45+
retries = Retry(total=5, backoff_factor=1, status_forcelist=[502, 503, 504])
46+
self.session.mount('http://', adapter)
47+
self.session.mount('https://', adapter)
48+
self.session.mount('http://', HTTPAdapter(max_retries=retries))
49+
self.session.mount('https://', HTTPAdapter(max_retries=retries))
50+
4251
def _get_balance(self) -> str:
4352
resp = self.session.post(url=self.HOST + "/getBalance", json={"clientKey": self.client_key})
4453
if resp.status_code != 200:

0 commit comments

Comments
 (0)