armatis package

Submodules

armatis.models module

class armatis.models.Company(name=None, code=None, phone=None, digit=None)

Bases: object

class armatis.models.Parcel(sender=None, receiver=None, invoice_number=None, address=None, note=None)

Bases: object

class armatis.models.Track(time=None, location=None, status=None, phone1=None, phone2=None)

Bases: object

class armatis.models.Tracker

Bases: object

add_track(new_track)
track_by_status(status)

Find the tracking information matching the status

Parameters:status (str) – The status to find the tracking information
Returns:The tracking information matching the status
tracks

armatis.parser module

class armatis.parser.Parser(invoice_number, config)

Bases: object

add_request(new_request)
add_track(new_track)

Add the tracking status information

Parameters:new_track (Track) – The tracking status information
find()
invoice_number
parcel
parse(parser)

Parse the response of the API request

Parameters:parser – The module for parsing the response
parser(doc)

The module for parsing the response of the API request

Parameters:doc (str) – The response of the API request
Returns:The module for parsing the response
requests
result()

Get the found parcel tracking informations

Returns:The found parcel and tracking informations
Return type:dict
class armatis.parser.ParserManager

Bases: object

register_parser(company, new_parser)

Register the new parser

Parameters:
  • company (Company) – The new company
  • new_parser (Parser) – The new parser
class armatis.parser.ParserRequest(url=None, method=None, body=None, header=None)

Bases: object

class armatis.parser.RequestManager(user_agent)

Bases: object

Provide the additional HTTP request information for browsing the API

add_request(new_request)
class armatis.parser.Source

Bases: object

add_track(new_track)
parcel
summary()
tracks
armatis.parser.dict2parser_request(pr_dict)

Module contents

Armatis

Armatis parses the website or web API response of Korean parcel delivery service company for tracking the parcel.

https://github.com/iBluemind/armatis

class armatis.Armatis(company_code=None, invoice_number=None, config=None)

Bases: object

default_config = {'INVOICE_NUMBER_VALIDATION': False, 'USER_AGENT_STRING': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)', 'MULTIPLE_REQUEST_PERIOD': 2}
find(company_code=None, invoice_number=None)

Track the parcel

Parameters:
  • company_code (str) – The company’s code to find the parcel
  • invoice_number (int) – The invoice number to find the parcel
Returns:

The result of the tracking parcel

Return type:

dict

last_result()

Return the most recent tracking result

Returns:The most recent tracking result
Return type:dict
parser(company_code, invoice_number)

Get the parser for specific company

Parameters:
  • company_code (str) – The company to find the parcel
  • invoice_number (int) – The invoice number to find the parcel
  • validation (bool) – Check the invoice number is valid
Returns:

The parser of the company

supported_companies()

Registered parsers and companies

Returns:The list of company’s name and company’s parser code
Return type:dict