Skip to content

Commit

Permalink
fix weixin data
Browse files Browse the repository at this point in the history
  • Loading branch information
foolcage committed Jul 8, 2018
1 parent c7ef8f9 commit 73c8047
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions fooltrader/bot/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ def send_message(self, to_user, title, body, **kv):
"color": "#173177"
},
"keyword1": {
"value": kv['name'],
"value": str(kv['name']),
"color": "#173177"
},
"keyword2": {
"value": kv['price'],
"value": str(kv['price']),
"color": "#173177"
},
"keyword3": {
"value": kv['change_pct'],
"value": str(kv['change_pct']),
"color": "#173177"
},
"remark": {
Expand All @@ -108,4 +108,9 @@ def send_message(self, to_user, title, body, **kv):

the_data = json.dumps(the_json, ensure_ascii=False).encode('utf-8')

requests.post(self.SEND_MSG_URL.format(self.token), the_data)
resp = requests.post(self.SEND_MSG_URL.format(self.token), the_data)

self.logger.info("send weixin resp:{}".format(resp.text))

if resp.json() and resp.json()["errcode"] == 0:
self.logger.info("send weixin to user:{} data:{} success".format(to_user, the_json))

0 comments on commit 73c8047

Please sign in to comment.