heefoo
2020-2-6 17:00:48

@heefoo has joined the channel


raymond.machira
2020-2-6 18:42:20

@raymond.machira has joined the channel


brentgordon146
2020-2-6 19:19:29

`(define (download-image) (define post (search-safebooru)) (define url (hash-ref post 'file_url)) (define md5 (hash-ref post 'md5)) (define file-ext (hash-ref post 'file_ext)) (define filename (string-append md5 "." file-ext)) (call-with-output-file filename (lambda (in) (display (port->bytes (get-pure-port (string->url url)))in)) #:exists 'replace) (define image (file->bytes filename)) (define data (string-append "--" boundary CRLF "Content-Disposition: form-data; name=\"file\"; filename=" filename CRLF "Content-Type: image/" (string-append file-ext CRLF))) image (string-append CRLF "--" boundary "--" CRLF)) (define (upload-image) (define-values (status headers response) (http-sendrecv server (string-append "/api/v1/media") #:ssl? #t #:method #"POST" #:headers (list (string-append "Content-Type: multipart/form-data; boundary=" boundary)(string-append "Authorization: Bearer " token)) #:data (download-image))) (displayln (read-json response)))


brentgordon146
2020-2-6 19:20:05

Am I doing multipart form requests right?


brentgordon146
2020-2-6 19:25:09

this is what i got by following a snippet i see online when i run this i just get 500 internal server error