[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/plz dd92f48895 65/81: Change: Default to :then 'sync an
From: |
ELPA Syncer |
Subject: |
[elpa] externals/plz dd92f48895 65/81: Change: Default to :then 'sync and :as 'string |
Date: |
Wed, 11 May 2022 17:58:02 -0400 (EDT) |
branch: externals/plz
commit dd92f488950dc43e05854be99a3a4e69c90812a2
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Change: Default to :then 'sync and :as 'string
This is most convenient for simple uses.
---
README.org | 19 ++++++++++++++-----
plz.el | 3 ++-
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/README.org b/README.org
index 06e9f7c48c..8f464f16b3 100644
--- a/README.org
+++ b/README.org
@@ -46,11 +46,21 @@ The only public function is ~plz~, which sends an HTTP
request and returns eithe
** Examples
+Synchronously =GET= a URL and return the response body as a decoded string
(here, raw JSON):
+
+#+BEGIN_SRC elisp :exports both :results value code
+ (plz 'get "https://httpbin.org/user-agent")
+#+END_SRC
+
+#+RESULTS:
+#+BEGIN_SRC elisp
+ "{\n \"user-agent\": \"curl/7.35.0\"\n}\n"
+#+END_SRC
+
Synchronously =GET= a URL that returns a JSON object, and parse and return it
as an alist:
#+BEGIN_SRC elisp :exports both :results value code
- (plz 'get "https://httpbin.org/get"
- :as #'json-read :then 'sync)
+ (plz 'get "https://httpbin.org/get" :as #'json-read)
#+END_SRC
#+RESULTS:
@@ -81,8 +91,7 @@ Asynchronously =POST= a JSON object in the request body, then
parse a JSON objec
Synchronously download a JPEG file, then create an Emacs image object from the
data:
#+BEGIN_SRC elisp :exports both
- (let ((jpeg-data (plz 'get "https://httpbin.org/image/jpeg"
- :as 'binary :then 'sync)))
+ (let ((jpeg-data (plz 'get "https://httpbin.org/image/jpeg" :as 'binary)))
(create-image jpeg-data nil 'data))
#+END_SRC
@@ -91,7 +100,7 @@ Synchronously download a JPEG file, then create an Emacs
image object from the d
** Functions
-+ ~plz~ :: /(method url &key headers body as then else finally noquery
(body-type 'text) (decode t decode-s) (connect-timeout plz-connect-timeout)
(timeout plz-timeout))/
++ ~plz~ :: /(method url &key headers body else finally noquery (as 'string)
(then 'sync) (body-type 'text) (decode t decode-s) (connect-timeout
plz-connect-timeout) (timeout plz-timeout))/
Request ~METHOD~ from ~URL~ with curl. Return the curl process object or,
for a synchronous request, the selected result.
diff --git a/plz.el b/plz.el
index ab4f4f89a5..86a9a270b5 100644
--- a/plz.el
+++ b/plz.el
@@ -212,7 +212,8 @@ connection phase and waiting to receive the response (the
;;;;; Public
-(cl-defun plz (method url &key headers body as then else finally noquery
+(cl-defun plz (method url &key headers body else finally noquery
+ (as 'string) (then 'sync)
(body-type 'text) (decode t decode-s)
(connect-timeout plz-connect-timeout) (timeout
plz-timeout))
"Request METHOD from URL with curl.
- [elpa] externals/plz a5f22b23e1 42/81: Add: (plz), (continued)
- [elpa] externals/plz a5f22b23e1 42/81: Add: (plz), ELPA Syncer, 2022/05/11
- [elpa] externals/plz 430ceffd1d 43/81: Change: Handle killed processes, ELPA Syncer, 2022/05/11
- [elpa] externals/plz f40d3ecbdd 47/81: Add/Change: :noquery argument for make-process, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 1884d038ae 46/81: Notes: Add note about Lars Ingebrigtsen's with-url macro, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 7478d43668 51/81: Revert "Add/Change: Handle LF-only HTTP responses", ELPA Syncer, 2022/05/11
- [elpa] externals/plz 8d2654bba7 49/81: Add/Change: Handle LF-only HTTP responses, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 220f882ee4 53/81: Tests: (plz-post-jpeg-string) Add, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 4a246e24f6 54/81: Add: Upload binary files, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 7c27e4bdcd 61/81: Change: Sync with accept-process-output, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 65030d5cc1 64/81: Tidy: Docstring, ELPA Syncer, 2022/05/11
- [elpa] externals/plz dd92f48895 65/81: Change: Default to :then 'sync and :as 'string,
ELPA Syncer <=
- [elpa] externals/plz cddccccf81 67/81: Docs: Fix link, ELPA Syncer, 2022/05/11
- [elpa] externals/plz f1a89a8816 68/81: Add: Download :as file, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 8cd1ef481d 73/81: Notes: Add links to skeeto's feedback, ELPA Syncer, 2022/05/11
- [elpa] externals/plz dd491941ab 79/81: Meta: Update makem.sh, ELPA Syncer, 2022/05/11
- [elpa] externals/plz da503527d2 76/81: Change: (plz--response) Error if unable to parse HTTP response, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 0a860d94dc 71/81: Tests: "There be dragons.", ELPA Syncer, 2022/05/11
- [elpa] externals/plz ce7afc17f9 63/81: Meta: Ignore .sandbox/, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 4736d5242a 66/81: Tests: (plz-test-wait) Change to function, test process argument, ELPA Syncer, 2022/05/11