This article mainly introduces the use of the micro-credit API in the Python bottle framework, the author also gives a generated micro-scan two-dimensional code map, the need for friends can refer to the
Micro-letter This thing estimated that otaku few unfamiliar, micro-letter after so many years of development finally to the open platform to make a friendly step. Egg pain thought the micro-letter will be a detailed API and other interfaces, excited to apply for the micro-trust platform, and then start looking for a variety of API location ...
Spent nearly one hours, still not found ...
Finally, the use of Google's big kill device, finally found such a link. I have a go, there is no more simple API documentation.
The most incomprehensible is that there is no local development environment support, every time to put in the production environment to debug.
The most gratifying is: the two methods, production environment debugging several times will be finished.
The Python (bottle) version of the code is as follows:
|1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 This is the only of the "a" of the--------------- TD style= "BORDER:0;PADDING:0;" > #-*-Coding:utf-8-*- from bottle import Debug, Default_app, run, get, request, post import sys, OS, time , Libxml2dom @get ('/') DEF index (): return request. Get.get (' echostr ') @post ('/') def index_post (): for key, value in request. Post.allitems (): doc = libxml2dom.parsestring (key) _to = Doc.xpath ('//fromusername ') .textcontent _from = Doc.xpath ('//tousername ') .textcontent #_content = Doc.xpath ('//content ') .textcontent Return "" <xml> <tousername><! [cdata[%s]]></tousername> <fromusername><! [cdata[%s]]></fromusername> <CREATETIME>%S</CREATETIME> <msgtype><! [cdata[text]]></msgtype> <content><! [cdata[%s]]></content> <FuncFlag>0</FuncFlag> </xml> "" "% (_to, _from, int ( Time.time (), U ' I got a Go ') if __name__ = = "__main__": # Interactive mode Debug (True) port = Int (s YS.ARGV If Len (SYS.ARGV) > 1 else 8888) Run (host= ' 0.0.0.0 ', Port=port, reloader=true) else: # M OD WSGI launch os.chdir (Os.path.dirname (__file__)) app = Default_app ()|