Beispiel #1
0
 def request(input_file, base_url, license_plates_token=None, version="1"):
     """
     Make request to license_plates endpoint
     :param input_file: Input object
     :param base_url: API base URL
     :param license_plates_token: License plate API token
     :param version: API version
     """
     url = os.path.join(base_url, "license_plates", "v" + version, "predict")
     return request(url, input_file, license_plates_token)
Beispiel #2
0
 def request(input_file,
             base_url,
             expense_receipt_token=None,
             invoice_token=None,
             include_words=False):
     """
     Make request to invoices endpoint if .pdf, expense_receipts otherwise
     :param include_words: Bool, extract all words into http_response
     :param input_file: Input object
     :param base_url: API base URL
     :param expense_receipt_token: Expense receipts API token
     :param invoice_token: Invoices API token
     """
     if "pdf" in input_file.file_extension:
         url = os.path.join(base_url, "invoices", "v1", "predict")
         return request(url, input_file, invoice_token, include_words)
     else:
         url = os.path.join(base_url, "expense_receipts", "v3", "predict")
         return request(url, input_file, expense_receipt_token,
                        include_words)
 def request(input_file,
             base_url,
             invoice_token=None,
             version="2",
             include_words=False):
     """
     Make request to invoices endpoint
     :param input_file: Input object
     :param base_url: API base URL
     :param invoice_token: Invoices API token
     :param include_words: Include Mindee vision words in http_response
     :param version: API version
     """
     url = os.path.join(base_url, "invoices", "v" + version, "predict")
     return request(url, input_file, invoice_token, include_words)
 def request(input_file, base_url, passport_token=None, version="1"):
     """
     Make request to passport endpoint
     """
     url = os.path.join(base_url, "passport", "v" + version, "predict")
     return request(url, input_file, passport_token)