Open Live Writer Code Insert plug-in test

Source: Internet
Author: User
Open Live Writer Code Insert plug-in test

#-*-coding:utf-8-*-import urllibimport jsonimport sysimport sslssl._create_default_https_context = Ssl._create_ Unverified_contextdef GetType (number): #定义取快递类型函数 def getlist (): #取快递类型列表 req = Urllib.urlopen (' Http://www.kuaidi1 00.com/autonumber/autocomnum?text=%d '%number) HTML = req.read () dict_html = json.loads (HTML) return  dict_html[' Auto ' for I in GetList (): type = i[' Comcode '] return typedef getprocess (URL): #定义获取快递进度函数 req = Urllib.urlopen (URL) html = req.read () #type = sys.getfilesystemencoding () #取文件系统编码类型 #html = Html.deco De (' utf-8 '). Encode (type) #utf -8 decoding This Code dict_info =json.loads (HTML) return dict_info[' data ' due to decoding conflict with JSON number= input (U "Please enter the Courier Number:") type = GetType (number) #获取快递类型Address = ' Http://www.kuaidi100.com/query?type=%s&postid =%d&id=1&valicode=&temp=0.33020057185034335 '% (type,number) for I in GetProcess (Address): Print i[' Ftime ' ] + i[' context ']

Test, the code function for check Express.

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.