This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from urllib3.util.retry import Retry | |
from requests.adapters import HTTPAdapter | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
s = requests.Session() | |
retries = Retry(total=3, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from requests.adapters import HTTPAdapter | |
import threading | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
s = requests.session() | |
def call(url): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
s = requests.Session() | |
for _ in range(5): | |
r = s.get('https://api.github.com') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
for _ in range(5): | |
r = requests.get('https://api.github.com') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from multiprocessing import Process | |
from timeit import default_timer as timer | |
def call(): | |
r = requests.get("https://httpbin.org/drip?duration=30&delay=0", timeout=(6.4, 20)) | |
p = Process(target=call) | |
start = timer() | |
p.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from timeit import default_timer as timer | |
from requests import exceptions as e | |
start = timer() | |
r = requests.get("https://httpbin.org/drip?duration=30&delay=0", timeout=(6.4, 6)) | |
end = timer() | |
print("Time spent waiting for the response - ", end - start, "Seconds") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
r = requests.get("https://httpbin.org/delay/9", timeout=(6.4, 11)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from timeit import default_timer as timer | |
from requests import exceptions as e | |
try: | |
start = timer() | |
r = requests.get("https://httpbin.org/delay/9", timeout=(6.4, 6)) | |
except e.ReadTimeout: | |
end = timer() | |
print("Timed out after", end - start, "Seconds") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from timeit import default_timer as timer | |
from requests import exceptions as e | |
start = timer() | |
try: | |
requests.get("https://api.github.com:88", timeout=(3.4, 20)) | |
except e.ConnectTimeout: | |
end = timer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
r = requests.get("https://api.github.com") |
NewerOlder