How to use Python to call the API interface of Wechat's official domain name
This article introduces the knowledge of "how to use Python to call the API interface of Wechat's official domain name". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Interface address:
Http://www.qqdwz.cn/ymjc?url_long=http://www.baidu.com
API description:
Replace the "http://www.baidu.com"" of the above Wechat domain name detection api interface with the link to be tested.
Return description:
{"status": 1, "msg": "Domain name normal"} {"status": 0, "msg": "Domain name blocked"} call code
Demo of PHP call:
$url = 'http://www.baidu.com';$api_url =' http://www.maoapi.cn/wxymjc?url_long?url_long=http://www.baidu.com;$short_url = file_get_contents ($api_url); echo $short_url
Demo of JAVA call:
Public static void main (String path []) throws Exception {URL u = new URL ("http://www.maoapi.cn/wxymjc?url_long?url_long=http://www.baidu.com");InputStream in = u.openStream (); ByteArrayOutputStream out = new ByteArrayOutputStream (); try {byte buf [] = new byte [1024]; int read = 0X while (read = in .read (buf)) > 0) {out.write (buf, 0, read);}} finally {if (in! = null) {in .close () }} byte b [] = out.toByteArray (); System.out.println (new String (b, "utf-8"));}
Demo of Python call:
Import urllib, urllib2, syshost = 'http://www.maoapi.cn'path =' / wxymjc?url_long'method = 'GET'querys =' url_long=http%3A%2F%2Fwww.baidu.com'bodys = {} url = host + path +'?'+ querysrequest = urllib2.Request (url) response = urllib2.urlopen (request) content = response.read () if (content): print (content), "how to use Python to call the API API of the official domain name of Wechat" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!