Skip to content

Add syntax highlighting to README #1

Merged
merged 1 commit into from Jul 1, 2012
+22 −21
View
43 README.md
@@ -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
------------
Something went wrong with that request. Please try again.