You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
will have far better performance and use less bandwidth due to not having to repeat tcp handshake and ssl handshakes. My tests show about twice as fast.
See 2 examples:
(venv) 15645(0811)mattjenkins@DatapriseMBP:Automox$ cat test.py test2.py
import requests
for x in range(1,100):
if (result := requests.get('https://www.google.com')):
pass
else:
print(False)
import requests
sess = requests.Session()
for x in range(1,100):
if (result := sess.get('https://www.google.com')):
pass
else:
print(False)
(venv) 15646(0811)mattjenkins@DatapriseMBP:Automox$ time python test.py
real 0m13.911s
user 0m1.774s
sys 0m0.149s
(venv) 15647(0811)mattjenkins@DatapriseMBP:Automox$ time python test2.py
real 0m6.672s
user 0m0.488s
sys 0m0.083s
The text was updated successfully, but these errors were encountered:
sess = requests.Session()
sess.get()
will have far better performance and use less bandwidth due to not having to repeat tcp handshake and ssl handshakes. My tests show about twice as fast.
See 2 examples:
(venv) 15645(0811)mattjenkins@DatapriseMBP:Automox$ cat test.py test2.py
import requests
for x in range(1,100):
if (result := requests.get('https://www.google.com')):
pass
else:
print(False)
import requests
sess = requests.Session()
for x in range(1,100):
if (result := sess.get('https://www.google.com')):
pass
else:
print(False)
(venv) 15646(0811)mattjenkins@DatapriseMBP:Automox$ time python test.py
real 0m13.911s
user 0m1.774s
sys 0m0.149s
(venv) 15647(0811)mattjenkins@DatapriseMBP:Automox$ time python test2.py
real 0m6.672s
user 0m0.488s
sys 0m0.083s
The text was updated successfully, but these errors were encountered: