Test the code insertion plug-in of Open Live Writer, livewriter

Source: Internet
Author: User

Test the code insertion plug-in of Open Live Writer, livewriter

1 #-*-coding: UTF-8-*-2 import urllib 3 import json 4 import sys 5 import ssl 6 ssl. _ create_default_https_context = ssl. _ create_unverified_context 7 8 def gettype (number): # define the function 9 def getlist (): # retrieve the express type list 10 req = urllib. urlopen ('HTTP: // www.kuaidi100.com/autonumber/autoComNum? Text = % d' % number) 11 html = req. read () 12 dict_html = json. loads (html) 13 return dict_html ['auto'] 14 for I in getlist (): 15 type = I ['comcode'] 16 return type 17 18 def getprocess (url ): # define the function 19 req = urllib to get the delivery progress. urlopen (url) 20 html = req. read () 21 # type = sys. getfilesystemencoding () # obtain the file system encoding type 22 # html = html. decode ('utf-8 '). encode (type) # UTF-8 decoding the decoded Code 23 dict_info = json. load S (html) 24 return dict_info ['data'] 25 26 27 28 number = input (u "Please enter the express waybill number:") 29 30 type = gettype (number) # Get the courier type 31 32 33 Address = 'HTTP: // www.kuaidi100.com/query? Type = % s & postid = % d & id = 1 & valicode = & temp = 0.33020057185034335 '% (type, number) 34 for I in getprocess (Address ): 35 print I ['ftime'] + I ['context']

Test the code function.

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.