123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- # A sample of input data can be generate from below code for invoice,resume,Businesscard,Attendence.
-
- import base64
- import json
- empty=[]
-
- found="file_path"
- name = found
- image = open(name, 'rb')
- image_read = image.read()
- image_64_encode = base64.b64encode(image_read)
- NULL = 'null'
- empty.append("ByteData--" + (NULL).strip('""'))
- image_64_encode = image_64_encode.decode('utf-8')
- empty.append("FileData--" + str(image_64_encode))
- imagedata = name.split("\\")
- imagename = str(imagedata[-1]).replace('"', '').replace("[", "").replace("]", "")
- imagename1 = str(imagename).split('.')
-
- imagename = str(imagename1[-2]).replace("[", "]")
- empty.append("FileName--" + imagename)
- empty.append("FilePath--" + found)
- imageExtension = str(imagename1[-1]).replace("[", "]")
- empty.append("FileType--" + imageExtension)
-
- import pandas as pd
- df = pd.DataFrame(empty)
- df = df[0].str.split("--", expand=True)
- data1 = pd.DataFrame(df[0])
- data2 = pd.DataFrame(df[1])
- dt = data2.set_index(data1[0])
-
- dt4 = dt.T
-
- dictionary = dt4.to_dict(orient="index")
- dictionary[1]
- payload1 = json.dumps(dictionary[1])
-
-
- print(payload1)
-
-
-
- #Note
- #when we have to test code using postman
- #after give url in body select json option then
- #add [] to the text generated from payload1 paste in the body and click send button
-
-
-
|