Skip to content

Instantly share code, notes, and snippets.

@salrashid123
Created August 26, 2017 20:24
Show Gist options
  • Save salrashid123/c6aafe9f93e9f14606b232b7964537d6 to your computer and use it in GitHub Desktop.
Save salrashid123/c6aafe9f93e9f14606b232b7964537d6 to your computer and use it in GitHub Desktop.
import ssl
from hyper import HTTPConnection
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.load_verify_locations(cafile="CA_crt.pem")
context.set_alpn_protocols(['http/1.1', "spdy/1", 'spdy/2', "spdy/3"])
conn = HTTPConnection('main.esodemoapp2.com', 50051, ssl_context=context, secure=True)
params = binascii.a2b_hex(frame)
headers = {"Content-type": "application/grpc", "TE": "trailers"}
conn.request(method="POST", url="/echo.EchoServer/SayHello", body=params, headers=headers)
resp = conn.get_response()
print response.status, response.reason
#print(resp.read())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment