June 14, 2020
teletype.in
Простота данной платформы подкупает, но сразу же нашел неудобность:
- Вставка кода работает категорически криво;
- Подсветка синтаксиса отсутствует как класс;
# coding=utf-8
# Created by JTProg
# Date: 06.08.2018
# https://jtprog.ru/
__author__ = 'jtprog'
__version__ = '0.0.1'
import threading
import urllib3
import time
import certifi
start = time.time()
urls = ["https://example.com"]
def fetch_url(url):
html = urllib3.PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where())
r = html.request('GET', url)
print("'%s\' fetched in %ss \n" % (url, (time.time() - start)))
threads = [threading.Thread(target=fetch_url, args=(url,)) for url in urls]
for thread in threads:
thread.start()
for thread in threads:
thread.join()
print("Elapsed Time: %s" % (time.time() - start))