This repository was archived by the owner on Jan 13, 2021. It is now read-only.
  
  
  
  
  
Description
Hello
I have written, below script to test my code for HTTP/2. But with my current script., I need to send authorization with every request, i.e my connection get closed after every request. Is there any way, we can retain connetion  with hyper.
Below is my code:
from hyper import HTTP20Connection
import hyper
import ssl
import time
header = {'Accept': 'application/xhtml+xml;v=2.0', 'Authorization': 'Basic RGVmYXVsdCBVc2VyOnJvYm90aWNz' }
Accept_header = {'Accept': 'application/xhtml+xml;v=2.0'}
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.options |= ssl.OP_NO_SSLv2
context.options |= ssl.OP_NO_SSLv3
with HTTP20Connection('localhost:443', force_proto='h2', ssl_context=context) as conn:
    conn.request('GET', '/', headers=header)
    resp = conn.get_response()
    
    print(resp.satus)
    
    conn.request('GET', '/ctrl')
    resp = conn.get_response()
    
    print(resp.status)
    print("Sleeping...")
    time.sleep(10)