Python发送 - PubSub (Websocket)
本节内容为Python实现GoEasy Rest接口发送消息, 使用时,可参阅Rest接口的详细介绍
Python
import requests
from requests.structures import CaseInsensitiveDict
# 新加坡rest-host:rest-singapore.goeasy.io
url = "https://rest-hz.goeasy.io/v2/pubsub/publish"
headers = CaseInsensitiveDict()
headers["Accept"] = "application/json"
headers["Content-Type"] = "application/json"
data = """
{
"appkey": "您的appkey",
"channel": "test_channel",
"content": "Hello, GoEasy!"
}
"""
resp = requests.post(url, headers=headers, data=data)
print(resp.status_code)
REST Host
杭州: rest-hz.goeasy.io
新加坡: rest-singapore.goeasy.io