Permalink
Browse files

Add syntax highlighting to README

  • Loading branch information...
1 parent 39f6045 commit 4dfaf2f64f0ed9c9a64cf1f5c08df9094107cc91 Dominik Dabrowski committed Jun 20, 2012
Showing with 22 additions and 21 deletions.
  1. +22 −21 README.md
View
@@ -5,32 +5,33 @@ python-spdy is a simple spdy parser/(de)muxer for python >= 2.7 (including 3.x).
usage
-----
+```python
- import spdy, spdy.frames
-
- #with an existing socket or something
- context = spdy.Context(side=spdy.SERVER, version=2)
+import spdy, spdy.frames
- while True:
- data = sock.recv(1024)
- if not data:
- break
+#with an existing socket or something
+context = spdy.Context(side=spdy.SERVER, version=2)
- context.incoming(data)
+while True:
+ data = sock.recv(1024)
+ if not data:
+ break
- while True:
- frame = context.get_frame()
- if not frame:
- break
-
- if isinstance(frame, spdy.frames.Ping):
- pong = spdy.frames.Ping(frame.ping_id)
- context.put_frame(pong)
-
- outgoing = context.outgoing()
- if outgoing:
- sock.sendall(outgoing)
+ context.incoming(data)
+ while True:
+ frame = context.get_frame()
+ if not frame:
+ break
+
+ if isinstance(frame, spdy.frames.Ping):
+ pong = spdy.frames.Ping(frame.ping_id)
+ context.put_frame(pong)
+
+ outgoing = context.outgoing()
+ if outgoing:
+ sock.sendall(outgoing)
+```
installation
------------

0 comments on commit 4dfaf2f

Please sign in to comment.