[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
08/35: import: json: Accept '#:http-fetch' in 'json-fetch'.
From: |
guix-commits |
Subject: |
08/35: import: json: Accept '#:http-fetch' in 'json-fetch'. |
Date: |
Sat, 21 May 2022 19:43:05 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 9a47fd56dd927995e68a2c894a237aed11aa32f7
Author: Philip McGrath <philip@philipmcgrath.com>
AuthorDate: Wed May 18 14:10:55 2022 -0400
import: json: Accept '#:http-fetch' in 'json-fetch'.
For example, supplying 'http-fetch/cached' would enable caching.
* guix/import/json.scm (json-fetch): Add '#:http-fetch' argument.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
guix/import/json.scm | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/guix/import/json.scm b/guix/import/json.scm
index 0c98bb25b8..ae00ee929e 100644
--- a/guix/import/json.scm
+++ b/guix/import/json.scm
@@ -35,13 +35,16 @@
json->scheme-file))
(define* (json-fetch url
+ #:key
+ (http-fetch http-fetch)
;; Note: many websites returns 403 if we omit a
;; 'User-Agent' header.
- #:key (headers `((user-agent . "GNU Guile")
- (Accept . "application/json"))))
+ (headers `((user-agent . "GNU Guile")
+ (Accept . "application/json"))))
"Return a representation of the JSON resource URL (a list or hash table), or
#f if URL returns 403 or 404. HEADERS is a list of HTTP headers to pass in
-the query."
+the query. HTTP-FETCH is called to perform the request: for example, to
+enable caching, supply 'http-fetch/cached'."
(guard (c ((and (http-get-error? c)
(let ((error (http-get-error-code c)))
(or (= 403 error)
- 02/35: gnu: elm: Rename package to match the command., (continued)
- 02/35: gnu: elm: Rename package to match the command., guix-commits, 2022/05/21
- 14/35: gnu: Add elm-url., guix-commits, 2022/05/21
- 12/35: gnu: Add elm-svg., guix-commits, 2022/05/21
- 35/35: news: Add entry for 'guix import elm'., guix-commits, 2022/05/21
- 16/35: gnu: Add elm-bytes., guix-commits, 2022/05/21
- 32/35: gnu: Add elm-ryannhg-date-format., guix-commits, 2022/05/21
- 15/35: gnu: Add elm-browser., guix-commits, 2022/05/21
- 19/35: gnu: Add elm-parser., guix-commits, 2022/05/21
- 25/35: gnu: Add elm-random., guix-commits, 2022/05/21
- 22/35: gnu: elm: Support 'elm reactor'., guix-commits, 2022/05/21
- 08/35: import: json: Accept '#:http-fetch' in 'json-fetch'.,
guix-commits <=
- 06/35: http-client: Accept '#:headers' in 'http-fetched/cached'., guix-commits, 2022/05/21
- 29/35: gnu: Add elm-justinmimbs-date., guix-commits, 2022/05/21
- 20/35: gnu: Add elm-project-metadata-utils., guix-commits, 2022/05/21
- 23/35: gnu: Add elm-todomvc., guix-commits, 2022/05/21
- 27/35: gnu: Add elm-danhandrea-elm-date-format., guix-commits, 2022/05/21
- 33/35: gnu: Add elm-terezka-intervals., guix-commits, 2022/05/21
- 21/35: gnu: Add elm-explorations-markdown., guix-commits, 2022/05/21
- 30/35: gnu: Add elm-justinmimbs-time-extra., guix-commits, 2022/05/21
- 18/35: gnu: Add elm-http., guix-commits, 2022/05/21
- 11/35: gnu: Add elm-html., guix-commits, 2022/05/21