Package: armatis
Armatis parses the website or web API response of Korean
parcel delivery service company for tracking the parcel.InstallationInstall Armatis with this following command:$pipinstallarmatisUsageArmatis is simple to use. Just need to type the delivery company code
and the invoice number.To find the parcel, just use the methodfind():fromarmatisimportArmatistracker=Armatis('cj',123456789123)tracker.find()You can use the methodsupported_companies()to find the supported
delivery company names and company codes.tracker.supported_companies()The returned data of the methodfind()is like below:{"company":{"contact":"1588-1255","name":"CJ대한통운"},"parcel":{"receiver":"(주*","sender":"한만*","note":"일반","address":"경기도 성남시 분당구******"},"tracks":[{"time":"2016-10-13 18:07:13","status":"간선상차","location":"파주Sub","phone1":"파주Sub(031-960-6566)","phone2":null},{"time":"2016-10-13 21:22:09","status":"집화처리","location":"경기파주","phone1":"경기파주(070-7779-1003)","phone2":null},{"time":"2016-10-14 02:06:39","status":"간선하차","location":"옥천HUB","phone1":null,"phone2":null},{"time":"2016-10-14 02:17:16","status":"간선하차","location":"옥천HUB","phone1":null,"phone2":null},{"time":"2016-10-14 02:25:10","status":"행낭포장","location":"옥천HUB","phone1":null,"phone2":null},{"time":"2016-10-14 04:06:49","status":"간선상차","location":"옥천HUB","phone1":null,"phone2":null},{"time":"2016-10-14 11:10:05","status":"간선하차","location":"분당A","phone1":"분당A(031-725-9222)","phone2":null},{"time":"2016-10-14 11:12:07","status":"배달출발","location":"분당대리점a(C15F)","phone1":"분당대리점a(C15F)(031-769-0516)","phone2":"01012345678"},{"time":"2016-10-14 16:44:35","status":"배달완료","location":"분당대리점a(C15F)","phone1":"분당대리점a(C15F)(031-769-0516)","phone2":"01012345678"}]}Supported delivery companiesThe following delivery companies are supported currently.CompanyTest existedLast UpdatedCJ대한통운, CVSNet편의점택배o2016-12-10로젠택배o2016-12-10현대택배o2016-12-10한진택배o2016-12-10KG로지스o2016-12-10GTX로지스o2017-01-02우체국택배o2017-01-06합동택배o2017-01-06EMSo2017-01-02KGB택배o2017-01-02How to add new companyYou can make the new delivery company parser easily.First, create a class which inheritParser, and implement the methodparse().fromarmatis.modelsimportParcel,Trackfromarmatis.parserimportParser,ParserRequestclassNewCompanyParser(Parser):def__init__(self,invoice_number,config):super(NewCompanyParser,self).__init__(invoice_number,config)# Describe the information about the website or web API provided by the delivery companyparser_request=ParserRequest(url='http://thecompany.co.kr/tracking?invno=%s'%self.invoice_number)self.add_request(parser_request)# Actually occurred parsing the website or web API provided abovedefparse(self,parser):tables=parser.find_all('tbody')parcel=Parcel()parcel.sender=...# Sender's nameparcel.receiver=...# Receiver's nameparcel.address=...# Receive addressparcel.note=...# Describe about the parcelself.parcel=parcel# Store the information about the parcel!trs=tables[1].find_all('tr')fortrintrs:track=Track()track.status=...# Status of the delivery historytrack.time=...# Time of the delivery historytrack.location=...# Location the parcel where it istrack.phone1=...# Contact of the locationtrack.phone2=...# Contact of the locationself.add_track(track)# Add the tracking information!And, make aCompanyinstance that describe the company.Finally, register thisCompanyobject with theParserclass
you made above.fromarmatisimportArmatis,Companytracker=Armatis()# Make a Company instance that describe the companythe_new_company=Company('새로운회사','nc','1234-5678',[10,12])# Register the Company object with the Parser class you madetracker.parser_manager.register_parser(the_new_company,NewCompanyParser)DocumentationCompleted documentation for Armatis is available onReadtheDocs.ContributingWelcome contributions! If you would like to contribute on Armatis,
please follow these steps:Fork this repositoryMake your changesInstall the requirements usingpip install-rrequirements.txtSubmit a pull request after runningmake ready