@@ -50,6 +50,7 @@ def parse_receipt(
5050 cut_pdf = True ,
5151 include_words = False ,
5252 cut_pdf_mode = 3 ,
53+ filename = None ,
5354 ):
5455 """
5556 :param cut_pdf_mode: Number (between 1 and 3 incl.) of pages to reconstruct a pdf with.
@@ -60,6 +61,7 @@ def parse_receipt(
6061 :param cut_pdf: Automatically reconstruct pdf with more than 4 pages
6162 :param input_type: String in {'path', 'stream', 'base64'}
6263 :param file: Receipt filepath (allowed jpg, png, tiff, pdf)
64+ :param filename: the name of the file (without the path)
6365 :param version: expense_receipt api version
6466 :return: Wrapped response with Receipts objects parsed
6567 """
@@ -68,7 +70,13 @@ def parse_receipt(
6870 "Missing 'expense_receipt_token' arg in parse_receipt() function."
6971 )
7072
71- input_file = Inputs (file , input_type , cut_pdf = cut_pdf , n_pdf_pages = cut_pdf_mode )
73+ input_file = Inputs (
74+ file ,
75+ input_type ,
76+ filename = filename ,
77+ cut_pdf = cut_pdf ,
78+ n_pdf_pages = cut_pdf_mode ,
79+ )
7280
7381 response = Receipt .request (
7482 input_file ,
@@ -109,6 +117,7 @@ def parse_passport(
109117 version = "1" ,
110118 cut_pdf = True ,
111119 cut_pdf_mode = 3 ,
120+ filename = None ,
112121 ):
113122 """
114123 :param cut_pdf_mode: Number (between 1 and 3 incl.) of pages to reconstruct a pdf with.
@@ -118,6 +127,7 @@ def parse_passport(
118127 :param cut_pdf: Automatically reconstruct pdf with more than 4 pages
119128 :param input_type: String in {'path', 'stream', 'base64'}
120129 :param file: Passport filepath (allowed jpg, png, pdf)
130+ :param filename: the name of the file (without the path)
121131 :param version: passport api version
122132 :return: Wrapped response with passports objects parsed
123133 """
@@ -126,7 +136,13 @@ def parse_passport(
126136 "Missing 'passport_token' arg in parse_passport() function."
127137 )
128138
129- input_file = Inputs (file , input_type , cut_pdf = cut_pdf , n_pdf_pages = cut_pdf_mode )
139+ input_file = Inputs (
140+ file ,
141+ input_type ,
142+ filename = filename ,
143+ cut_pdf = cut_pdf ,
144+ n_pdf_pages = cut_pdf_mode ,
145+ )
130146
131147 response = Passport .request (input_file , self .passport_token , version )
132148
@@ -139,6 +155,7 @@ def parse_license_plate(
139155 version = "1" ,
140156 cut_pdf = True ,
141157 cut_pdf_mode = 3 ,
158+ filename = None ,
142159 ):
143160 """
144161 :param cut_pdf_mode: Number (between 1 and 3 incl.) of pages to reconstruct a pdf with.
@@ -148,6 +165,7 @@ def parse_license_plate(
148165 :param cut_pdf: Automatically reconstruct pdf with more than 4 pages
149166 :param input_type: String in {'path', 'stream', 'base64'}
150167 :param file: CarPlate filepath (allowed jpg, png, pdf)
168+ :param filename: the name of the file (without the path)
151169 :param version: license_plates api version
152170 :return: Wrapped response with CarPlates objects parsed
153171 """
@@ -156,7 +174,13 @@ def parse_license_plate(
156174 "Missing 'license_plate_token' arg in license_plate_token() function."
157175 )
158176
159- input_file = Inputs (file , input_type , cut_pdf = cut_pdf , n_pdf_pages = cut_pdf_mode )
177+ input_file = Inputs (
178+ file ,
179+ input_type ,
180+ filename = filename ,
181+ cut_pdf = cut_pdf ,
182+ n_pdf_pages = cut_pdf_mode ,
183+ )
160184
161185 response = CarPlate .request (input_file , self .license_plate_token , version )
162186
@@ -170,6 +194,7 @@ def parse_invoice(
170194 cut_pdf = True ,
171195 include_words = False ,
172196 cut_pdf_mode = 3 ,
197+ filename = None ,
173198 ):
174199 """
175200 :param cut_pdf_mode: Number (between 1 and 3 incl.) of pages to reconstruct a pdf with.
@@ -179,14 +204,21 @@ def parse_invoice(
179204 :param include_words: Bool, extract all words into http_response
180205 :param cut_pdf: Automatically reconstruct pdf with more than 4 pages
181206 :param input_type: String in {'path', 'stream', 'base64'}
182- :param file: Invoice filepath (allowed jpg, png, pdf)
207+ :param file: Invoice full path (allowed jpg, png, pdf)
208+ :param filename: the name of the file (without the path)
183209 :param version: invoices api version
184210 :return: Wrapped response with Invoices objects parsed
185211 """
186212 if not self .invoice_token :
187213 raise Exception ("Missing 'invoice_token' arg in parse_invoice() function." )
188214
189- input_file = Inputs (file , input_type , cut_pdf = cut_pdf , n_pdf_pages = cut_pdf_mode )
215+ input_file = Inputs (
216+ file ,
217+ input_type ,
218+ filename = filename ,
219+ cut_pdf = cut_pdf ,
220+ n_pdf_pages = cut_pdf_mode ,
221+ )
190222
191223 response = Invoice .request (
192224 input_file , self .invoice_token , version , include_words
@@ -201,6 +233,7 @@ def parse_financial_document(
201233 cut_pdf = True ,
202234 include_words = False ,
203235 cut_pdf_mode = 3 ,
236+ filename = None ,
204237 ):
205238 """
206239 :param cut_pdf_mode: Number (between 1 and 3 incl.) of pages to reconstruct a pdf with.
@@ -211,14 +244,21 @@ def parse_financial_document(
211244 :param cut_pdf: Automatically reconstruct pdf with more than 4 pages
212245 :param input_type: String in {'path', 'stream', 'base64'}
213246 :param file: Invoice or Receipt filepath (allowed jpg, png, pdf)
247+ :param filename: the name of the file (without the path)
214248 :return: Wrapped response with FinancialDocument objects parsed
215249 """
216250 if not self .invoice_token or not self .expense_receipt_token :
217251 raise Exception (
218252 "parse_invoice() function must include 'invoice_token' and 'expense_receipt_token' args."
219253 )
220254
221- input_file = Inputs (file , input_type , cut_pdf = cut_pdf , n_pdf_pages = cut_pdf_mode )
255+ input_file = Inputs (
256+ file ,
257+ input_type ,
258+ filename = filename ,
259+ cut_pdf = cut_pdf ,
260+ n_pdf_pages = cut_pdf_mode ,
261+ )
222262
223263 response = FinancialDocument .request (
224264 input_file ,
0 commit comments