[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to send a request to a Website.

From: Eric Abrahamsen
Subject: Re: How to send a request to a Website.
Date: Thu, 20 Apr 2017 10:24:25 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Thierry Leurent <> writes:

> Thank you your help but it don't work.
> It's not a syntax problem. 
> The code return a result. IMHO, it's a trouble with the content of the http 
> request. 
> I'm not an lisp programmer and I have some trouble to understand how the code 
> work.

Okay sorry, I was just fixing the obvious lisp errors in your example, I
didn't actually try the code.

`url-retrieve-synchronously' returns a buffer containing the URL
contents, not the data itself. So it should look like this:

(require 'url)
(require 'url-http)
(require 'json)
(defvar data-buffer
  (let ((url-request-method "POST")
         `(("Content-Type" . "application/x-www-form-urlencoded")
           ("Authorization" . "bearer 
        (url-request-data (json-encode '(:title "Post using emacs."))))
(display-buffer data-buffer)

If there's something wrong with the actual authorization process, of
course, I won't be able to help with that. But to my knowledge the above
should be the equivalent of the Python code you posted.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]