@@ -43,6 +43,18 @@ def barcode_scan(self, file=None):
43
43
if not 200 <= r .status_code < 300 :
44
44
raise APIError (data ['code' ], data ['message' ])
45
45
return data
46
+
47
+ def dns_lookup (self , domain = None , type = None ):
48
+ json = {
49
+ 'domain' : domain ,
50
+ 'type' : type
51
+ }
52
+ r = requests .post (API_URL + '/dns/lookup' , auth = self .interceptor ,
53
+ json = json )
54
+ data = r .json ()
55
+ if not 200 <= r .status_code < 300 :
56
+ raise APIError (data ['code' ], data ['message' ])
57
+ return data
46
58
47
59
def email_verify (self , email = None ):
48
60
json = {'email' : email }
@@ -75,6 +87,22 @@ def image_resize(self, file=None, width=None, height=None, crop=None):
75
87
raise APIError (data ['code' ], data ['message' ])
76
88
return data
77
89
90
+ def pdf_extract_image (self , file = None ):
91
+ files = {'file' : open (file , 'rb' )}
92
+ r = requests .post (API_URL + '/pdf/extract-image' , auth = self .interceptor , files = files )
93
+ data = r .json ()
94
+ if not 200 <= r .status_code < 300 :
95
+ raise APIError (data ['code' ], data ['message' ])
96
+ return data
97
+
98
+ def pdf_to_image (self , file = None ):
99
+ files = {'file' : open (file , 'rb' )}
100
+ r = requests .post (API_URL + '/pdf/to-image' , auth = self .interceptor , files = files )
101
+ data = r .json ()
102
+ if not 200 <= r .status_code < 300 :
103
+ raise APIError (data ['code' ], data ['message' ])
104
+ return data
105
+
78
106
def text_sentiment (self , text = None ):
79
107
json = {'text' : text }
80
108
r = requests .post (API_URL + '/text/sentiment' , auth = self .interceptor ,
@@ -107,6 +135,15 @@ def text_summary(self, text=None, url=None, language=None, length=None):
107
135
raise APIError (data ['code' ], data ['message' ])
108
136
return data
109
137
138
+ def word_lookup (self , word = None ):
139
+ json = {'word' : word }
140
+ r = requests .post (API_URL + '/word/lookup' , auth = self .interceptor ,
141
+ json = json )
142
+ data = r .json ()
143
+ if not 200 <= r .status_code < 300 :
144
+ raise APIError (data ['code' ], data ['message' ])
145
+ return data
146
+
110
147
class APIError (Exception ):
111
148
def __init__ (self , code , message ):
112
149
self .code = code
0 commit comments