소스 검색

add python put example

Daniel Gruno 5 년 전
부모
커밋
4bcbcdaf74
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  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.