help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to send a request to a Website.


From: Kevin Buchs
Subject: Re: How to send a request to a Website.
Date: Thu, 20 Apr 2017 18:15:59 +0000

I was trying to understand how your code could work, but the HTTP 401
status suggested it was working, partially at least. One item that stood
out was that you hardcoded the SAML token. I would expect that would only
expire after some time. So maybe the rest of your code does the token
request and you gave us an example token.

I'd suggest you make the changes Eric proposed and then give us the code
and the response you got. If you are using the token as a variable and not
hardcoded please send corresponding code.



On Thu, Apr 20, 2017 at 10:24 AM Eric Abrahamsen <address@hidden>
wrote:

> Thierry Leurent <address@hidden> 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")
>         (url-request-extra-headers
>          `(("Content-Type" . "application/x-www-form-urlencoded")
>            ("Authorization" . "bearer
> 1zzpkqkabx2v424kjn8yqmfjhywzny6sn2bmb7kt")))
>         (url-request-data (json-encode '(:title "Post using emacs."))))
>     (url-retrieve-synchronously "
> https://asgardian.be/WordPress/wp-json/wp/v2/posts?state=1234&access_token=1zzpkqkabx2v424kjn8yqmfjhywzny6sn2bmb7kt
> ")))
> (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.
>
> Eric
>
>
>


reply via email to

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