@@ -99,6 +99,8 @@ def nsfw(
9999 blob : Union [NSFWParams , bytes ],
100100 options : NSFWParams = None ,
101101 ) -> NSFWResponse :
102+ path = "/validate/nsfw"
103+ options = options or {}
102104 if isinstance (
103105 blob , dict
104106 ): # If params is provided as a dict, we assume it's the first argument
@@ -109,18 +111,14 @@ def nsfw(
109111 verb = "post" ,
110112 ).perform_with_content ()
111113 return resp
112-
113- options = options or {}
114- path = build_path (base_path = "/validate/nsfw" , params = options )
115- content_type = options .get ("content_type" , "application/octet-stream" )
116- headers = {"Content-Type" : content_type }
117-
114+
115+ files = {"file" : blob }
118116 resp = Request (
119117 config = self .config ,
120118 path = path ,
121119 params = options ,
122120 data = blob ,
123- headers = headers ,
121+ files = files ,
124122 verb = "post" ,
125123 ).perform_with_content ()
126124 return resp
@@ -188,28 +186,26 @@ async def nsfw(
188186 blob : Union [NSFWParams , bytes ],
189187 options : NSFWParams = None ,
190188 ) -> NSFWResponse :
189+ path = "/validate/nsfw"
190+ options = options or {}
191191 if isinstance (
192192 blob , dict
193193 ): # If params is provided as a dict, we assume it's the first argument
194194 resp = await AsyncRequest (
195195 config = self .config ,
196- path = "/validate/nsfw" ,
196+ path = path ,
197197 params = cast (Dict [Any , Any ], blob ),
198198 verb = "post" ,
199199 ).perform_with_content ()
200200 return resp
201-
202- options = options or {}
203- path = build_path (base_path = "/validate/nsfw" , params = options )
204- content_type = options .get ("content_type" , "application/octet-stream" )
205- headers = {"Content-Type" : content_type }
206-
201+
202+ files = {"file" : blob }
207203 resp = await AsyncRequest (
208204 config = self .config ,
209205 path = path ,
210206 params = options ,
211207 data = blob ,
212- headers = headers ,
208+ files = files ,
213209 verb = "post" ,
214210 ).perform_with_content ()
215211 return resp
0 commit comments