Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. # coding:utf-8
  2. import os
  3. import urllib2
  4. import json
  5. import httplib2)
  6.  
  7. content = "一些中文"
  8.  
  9. body = {
  10. "touser":"abcdefg",
  11. "msgtype":"text",
  12. "text":
  13. {
  14. "content": content
  15. }
  16. }
  17.  
  18. access_token = '1234567890'
  19. req_url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=' + access_token
  20. method = 'POST'
  21. headers['Content-Type'] = 'application/json'
  22. headers['Accept-Charset'] = 'encoding=utf-8'
  23. resp, token = http_obj.request(req_url, method, headers=headers, body=json.dumps(body))
  24.  
  25. json.dumps(body, ensure_ascii=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement