Examples of using the micro-credit API in the Python bottle framework

Source: Internet
Author: User
Tags cdata xpath

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 ') [0].textcontent   _from = Doc.xpath ('//tousername ') [0].textcontent   #_content = Doc.xpath ('//content ') [0].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[1] 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 ()
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.