Skip to content

Instantly share code, notes, and snippets.

@jhonata-menezes
Created March 27, 2018 12:20
Show Gist options
  • Save jhonata-menezes/955dc0439cd5f75a7fa2bd30ac48f13f to your computer and use it in GitHub Desktop.
Save jhonata-menezes/955dc0439cd5f75a7fa2bd30ac48f13f to your computer and use it in GitHub Desktop.
ttfb with python 3.6
import time
from urllib import request
host = "https://www.buscape.com.br/notebook"
opener = request.build_opener()
request = request.Request(host)
request.add_header('user-agent', 'firefox')
start = time.time()
resp = opener.open(request)
# read one byte
resp.read(1)
ttfb = time.time() - start
print("The TTFirst Byte of " +host+" is: "+str(ttfb))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment