ソースを参照

Add 'readme.md'

SadhulaSaiKumar 1年前
コミット
70199f7806
1個のファイルの変更48行の追加0行の削除
  1. 48
    0
      readme.md

+ 48
- 0
readme.md ファイルの表示

@@ -0,0 +1,48 @@
1
+ A sample of input data can be generate from below code for invoice,resume,Businesscard,Attendence.
2
+ 
3
+ 
4
+ 
5
+import base64
6
+import json
7
+empty=[]
8
+
9
+found="file_path"
10
+name = found
11
+image = open(name, 'rb')
12
+image_read = image.read()
13
+image_64_encode = base64.b64encode(image_read)
14
+NULL = 'null'
15
+empty.append("ByteData--" + (NULL).strip('""'))
16
+image_64_encode = image_64_encode.decode('utf-8')
17
+empty.append("FileData--" + str(image_64_encode))
18
+imagedata = name.split("\\")
19
+imagename = str(imagedata[-1]).replace('"', '').replace("[", "").replace("]", "")
20
+imagename1 = str(imagename).split('.')
21
+
22
+imagename = str(imagename1[-2]).replace("[", "]")
23
+empty.append("FileName--" + imagename)
24
+empty.append("FilePath--" + found)
25
+imageExtension = str(imagename1[-1]).replace("[", "]")
26
+empty.append("FileType--" + imageExtension)
27
+
28
+import pandas as pd
29
+df = pd.DataFrame(empty)
30
+df = df[0].str.split("--", expand=True)
31
+data1 = pd.DataFrame(df[0])
32
+data2 = pd.DataFrame(df[1])
33
+dt = data2.set_index(data1[0])
34
+
35
+dt4 = dt.T
36
+  
37
+dictionary = dt4.to_dict(orient="index")
38
+dictionary[1]
39
+payload1 = json.dumps(dictionary[1])
40
+
41
+print(payload1)
42
+
43
+## note
44
+
45
+
46
+when we have to test code using postman
47
+after give url in body select json option then 
48
+add [] to the text generated from payload1 paste in the body and click send button

読み込み中…
キャンセル
保存