Explorar o código

add python put example

Daniel Gruno %!s(int64=5) %!d(string=hai) anos
pai
achega
4bcbcdaf74
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      README.md

+ 8 - 0
README.md

@@ -26,6 +26,14 @@ Once whitelisted, clients can do a POST or PUT to the pubsub service on port 206
 
 Event payloads *MUST* be in dictionary (hash) format, or they will be rejected.
 
+### Pushing an event via Python
+To push an event to PyPubSub via Python, you can make use of the requests library in Python:
+
+~~~
+import requests
+requests.put('http://localhost:2069/fruits/apples', json = {"applesort": "macintosh"})
+~~~
+
 ## Listening for events in PyPubSub via cURL
 You can subscribe to topics via cURL like so: `curl http://localhost:2069/topics/here` where `topics/here` are the topics you are subscribing to, with `/` as a delimiter between topics. To subscribe to *all* events, you can omit the topics.