Skip to content

Commit 2896a12

Browse files
authored
Merge pull request #554 from leancloud/fix-conn-reset
fix connection reset error
2 parents 84cac98 + 44f4c45 commit 2896a12

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ six = ">=1.11.0"
2121
qiniu = ">=7.1.4,<7.2.4"
2222
"urllib3" = ">=1.24.3,<=1.25.3"
2323
requests = ">=2.20.0,<=2.22.0"
24+
requests-toolbelt = ">=1.0.0"
2425
Werkzeug = ">=0.11.11,<1.0.0"
2526
gevent = ">=22.10.2,<23.0.0"
2627
typing = { version = "*", markers = "python_version < '3.5.0'" }

leancloud/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import six
1515
import requests
16+
from requests_toolbelt.adapters.socket_options import TCPKeepAliveAdapter
1617

1718
import leancloud
1819
from leancloud import utils
@@ -43,6 +44,8 @@
4344

4445
app_router = None
4546
session = requests.Session()
47+
session.mount("http://", TCPKeepAliveAdapter())
48+
session.mount("https://", TCPKeepAliveAdapter())
4649
request_hooks = {}
4750

4851
SERVER_VERSION = "1.1"

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ iso8601>=0.1.14
44
six>=1.11.0
55
qiniu>=7.3.1
66
requests>=2.25.1
7+
requests-toolbelt>=1.0.0
78
urllib3<2
89
Werkzeug>=0.16.0,<2.0.0
910
secure-cookie>=0.1.0,<1.0.0

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
'six>=1.11.0',
1313
'qiniu==7.3.1',
1414
'requests>=2.25.1',
15+
'requests-toolbelt>=1.0.0',
1516
'Werkzeug>=0.16.0,<2.0.0',
1617
'secure-cookie>=0.1.0,<1.0.0',
1718
'gevent>=22.10.2,<23.0.0',

0 commit comments

Comments
 (0)