Closed azzamsa closed 5 years ago
After reading patiently through issue to see more usage example. I tried :sync t
The docs said:
Synchronous request is functional, but please don’t use it other than testing or debugging. Emacs users have better things to do rather than waiting for HTTP request. If you want a better way to write callback chains, use request-deferred.
Waiting synchronous is boring, But for now I have no other option. Using Emacs-deferred just add more complexity, IMHO.
Works using :sync t
ELISP> (let* ((thisola (request "https://time.siswadi.com/pray/Malang"
:parser 'json-read
:sync t)))
(request-response-data thisola))
((data
(Fajr . "04:00")
(Sunrise . "05:22")
(Dhuhr . "11:38")
(Asr . "15:03")
(Sunset . "17:55")
(Maghrib . "17:55")
(Isha . "19:08")
(SepertigaMalam . "21:44")
(TengahMalam . "23:38")
(DuapertigaMalam . "01:33")
(method .
["Egypt" "Egyptian General Authority of Survey" "Fajr: 19.5° - Isha'a: 17.5°"]))
(time
(date . "2019-01-14")
(time . "21:35:43")
(timezone . "Asia/Jakarta")
(offset . 7))
(location
(latitude . "-7.9666204000")
(longitude . "112.6326321000")
(address . "Malang, Malang City, East Java, Indonesia"))
(debug
(sunrise . "05:20")
(sunset . "17:57"))
(status . "OK"))
Failed without :sync t
ELISP> (let* ((thisola (request "https://time.siswadi.com/pray/Malang"
:parser 'json-read)))
(request-response-data thisola))
nil
I agree that we need more usage examples https://github.com/tkf/emacs-request/issues/71. I don't find sync
is mentioned in readme and in tkf example in his SO answers about emacs-request.
Hi @azzamsa I'll try to take another look at this but I have a little bit of a hard time reading your code, I think because of the way ielm represents data.
I'm also just filling in temporarily for the maintainer and am very slow debugging code. If you can do any more work tracking down the source of the problem that would be fantastic. perhaps start by pasting both your working code and your failing code to a pastebin so I can easily run it?
Also, there are several improvements in the development branch: https://github.com/tkf/emacs-request/tree/development . Can you see if your problem still exists there?
Thank you!
@titaniumbones We replied to main issue at the same seconds :)
Spend hour debugging my code, turn out that emacs-request had 'strange' behavior. Or maybe I am missing something.
1)
request-response-data
works using setq2)
request-response-data
didn't work if I use it directly3)
request-response-data
didn't work using letUsing example in readme also didn't work
But
:success
workedThanks