Explorar el Código

add python put example

Daniel Gruno hace 5 años
padre
commit
4bcbcdaf74
Se han modificado 1 ficheros con 8 adiciones y 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.