Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
5b521e60
Commit
5b521e60
authored
Aug 28, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python: update README.rst
parent
fb6ef096
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
0 deletions
+58
-0
python/README.rst
python/README.rst
+29
-0
python/setup.py
python/setup.py
+29
-0
No files found.
python/README.rst
View file @
5b521e60
...
...
@@ -82,3 +82,32 @@ Here is a simple SPDY server::
cert_file=CERT_FILE,
key_file=KEY_FILE)
server.start()
Here is a simple SPDY client::
#!/usr/bin/env python
# The example SPDY client. You need Python 3.3 or later because we
# use TLS NPN.
#
# Usage: spdyclient.py URL...
#
import sys
import spdylay
class MyStreamHandler(spdylay.BaseSPDYStreamHandler):
def on_header(self, nv):
sys.stdout.write('Stream#{}\n'.format(self.stream_id))
for k, v in nv:
sys.stdout.write('{}: {}\n'.format(k, v))
def on_data(self, data):
sys.stdout.write('Stream#{}\n'.format(self.stream_id))
sys.stdout.buffer.write(data)
def on_close(self, status_code):
sys.stdout.write('Stream#{} closed\n'.format(self.stream_id))
if __name__ == '__main__':
uris = sys.argv[1:]
spdylay.urlfetch(uris, MyStreamHandler)
python/setup.py
View file @
5b521e60
...
...
@@ -98,6 +98,35 @@ Here is a simple SPDY server::
cert_file=CERT_FILE,
key_file=KEY_FILE)
server.start()
Here is a simple SPDY client::
#!/usr/bin/env python
# The example SPDY client. You need Python 3.3 or later because we
# use TLS NPN.
#
# Usage: spdyclient.py URL...
#
import sys
import spdylay
class MyStreamHandler(spdylay.BaseSPDYStreamHandler):
def on_header(self, nv):
sys.stdout.write('Stream#{}
\n
'.format(self.stream_id))
for k, v in nv:
sys.stdout.write('{}: {}
\n
'.format(k, v))
def on_data(self, data):
sys.stdout.write('Stream#{}
\n
'.format(self.stream_id))
sys.stdout.buffer.write(data)
def on_close(self, status_code):
sys.stdout.write('Stream#{} closed
\n
'.format(self.stream_id))
if __name__ == '__main__':
uris = sys.argv[1:]
spdylay.urlfetch(uris, MyStreamHandler)
"""
,
classifiers
=
[
'Development Status :: 4 - Beta'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment