{"id":13837179,"url":"https://github.com/tkf/emacs-request","last_synced_at":"2025-05-15T05:07:21.362Z","repository":{"id":6030269,"uuid":"7254391","full_name":"tkf/emacs-request","owner":"tkf","description":"Request.el -- Easy HTTP request for Emacs Lisp","archived":false,"fork":false,"pushed_at":"2025-02-19T23:54:16.000Z","size":618,"stargazers_count":639,"open_issues_count":11,"forks_count":94,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-05-10T13:52:37.964Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://tkf.github.com/emacs-request/","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tkf.png","metadata":{"files":{"readme":"README.in.rst","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-12-20T08:24:30.000Z","updated_at":"2025-05-10T07:04:24.000Z","dependencies_parsed_at":"2025-04-03T21:10:01.059Z","dependency_job_id":"3dbee8f6-2df8-43c5-86a0-847cb5d0f02b","html_url":"https://github.com/tkf/emacs-request","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkf%2Femacs-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkf%2Femacs-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkf%2Femacs-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkf%2Femacs-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkf","download_url":"https://codeload.github.com/tkf/emacs-request/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254276447,"owners_count":22043867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T15:01:02.696Z","updated_at":"2025-05-15T05:07:16.350Z","avatar_url":"https://github.com/tkf.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"|build-status| |melpa-badge| |melpa-stable-badge|\n\n====================================\n request.el -- an elisp HTTP library\n====================================\n\n.. COMMENTARY (see Makefile)\n\nInstall\n=======\nAs described in `Getting started`_, ensure melpa's whereabouts in ``init.el`` or ``.emacs``::\n\n   (add-to-list 'package-archives '(\"melpa\" . \"https://melpa.org/packages/\"))\n\nThen\n\n::\n\n   M-x package-refresh-contents RET\n   M-x package-install RET request RET\n\nAlternatively, directly clone this repo and ``make install``.\n\nExamples\n========\nGET:\n\n.. code:: emacs-lisp\n\n  (request \"http://httpbin.org/get\"\n    :params '((\"key\" . \"value\") (\"key2\" . \"value2\"))\n    :parser 'json-read\n    :success (cl-function\n              (lambda (\u0026key data \u0026allow-other-keys)\n                (message \"I sent: %S\" (assoc-default 'args data)))))\n\nPOST:\n\n.. code:: emacs-lisp\n\n  (request \"http://httpbin.org/post\"\n    :type \"POST\"\n    :data '((\"key\" . \"value\") (\"key2\" . \"value2\"))\n    ;; :data \"key=value\u0026key2=value2\"  ;; this is equivalent\n    :parser 'json-read\n    :success (cl-function\n              (lambda (\u0026key data \u0026allow-other-keys)\n                (message \"I sent: %S\" (assoc-default 'form data)))))\n\nBlock until completion:\n\n.. code:: emacs-lisp\n\n  (request \"http://httpbin.org/get\"\n    :sync t\n    :complete (cl-function\n               (lambda (\u0026key response \u0026allow-other-keys)\n                 (message \"Done: %s\" (request-response-status-code response)))))\n\nCurl authentication:\n\n.. code:: emacs-lisp\n\n   (request \"http://httpbin.org/get\"\n     :auth \"digest\" ;; or \"basic\", \"anyauth\", etc., which see curl(1)\n     :complete (cl-function\n                (lambda (\u0026key response \u0026allow-other-keys)\n                  (message \"Done: %s\" (request-response-status-code response)))))\n\nRequest binary data:\n\n.. code:: emacs-lisp\n\n  (request \"http://httpbin.org/get\"\n    :encoding 'binary\n    :complete (cl-function\n               (lambda (\u0026key response \u0026allow-other-keys)\n                 (message \"Done: %s\" (request-response-status-code response)))))\n\nPOST file (**WARNING**: it will send the contents of the current buffer!):\n\n.. code:: emacs-lisp\n\n  (request \"http://httpbin.org/post\"\n    :type \"POST\"\n    :files `((\"current buffer\" . ,(current-buffer)))\n    :parser 'json-read\n    :success (cl-function\n              (lambda (\u0026key data \u0026allow-other-keys)\n                (message \"I sent: %S\" (assoc-default 'files data)))))\n\nRich callback dispatch (like `jQuery.ajax`):\n\n.. code:: emacs-lisp\n\n  (request \"http://httpbin.org/status/418\"\n    ;; \"http://httpbin.org/status/200\"  ;; success callback will be called.\n    ;; \"http://httpbin.org/status/400\"  ;; you will see \"Got 400.\"\n    :parser 'buffer-string\n    :success\n    (cl-function (lambda (\u0026key data \u0026allow-other-keys)\n                   (when data\n                     (with-current-buffer (get-buffer-create \"*request demo*\")\n                       (erase-buffer)\n                       (insert data)\n                       (pop-to-buffer (current-buffer))))))\n    :error\n    (cl-function (lambda (\u0026rest args \u0026key error-thrown \u0026allow-other-keys)\n                   (message \"Got error: %S\" error-thrown)))\n    :complete (lambda (\u0026rest _) (message \"Finished!\"))\n    :status-code '((400 . (lambda (\u0026rest _) (message \"Got 400.\")))\n                   (418 . (lambda (\u0026rest _) (message \"Got 418.\")))))\n\nFlexible PARSER option:\n\n.. code:: emacs-lisp\n\n  (request \"https://github.com/tkf/emacs-request/commits/master.atom\"\n    ;; Parse XML in response body:\n    :parser (lambda () (libxml-parse-xml-region (point) (point-max)))\n    :success (cl-function\n              (lambda (\u0026key data \u0026allow-other-keys)\n                ;; Just don't look at this function....\n                (let ((get (lambda (node \u0026rest names)\n                             (if names\n                                 (apply get\n                                        (first (xml-get-children\n                                                node (car names)))\n                                        (cdr names))\n                               (first (xml-node-children node))))))\n                  (message \"Latest commit: %s (by %s)\"\n                           (funcall get data 'entry 'title)\n                           (funcall get data 'entry 'author 'name))))))\n\nPUT JSON data:\n\n.. code:: emacs-lisp\n\n  (request \"http://httpbin.org/put\"\n    :type \"PUT\"\n    :data (json-encode '((\"key\" . \"value\") (\"key2\" . \"value2\")))\n    :headers '((\"Content-Type\" . \"application/json\"))\n    :parser 'json-read\n    :success (cl-function\n              (lambda (\u0026key data \u0026allow-other-keys)\n                (message \"I sent: %S\" (assoc-default 'json data)))))\n\nPUT JSON data including non-ascii strings:\n\n.. code:: emacs-lisp\n\n  (request \"http://httpbin.org/put\"\n    :type \"PUT\"\n    :data (json-encode '((\"key\" . \"値1\") (\"key2\" . \"値2\")))\n    :headers '((\"Content-Type\" . \"application/json\"))\n    :parser 'json-read\n    :encoding 'utf-8\n    :success (cl-function\n              (lambda (\u0026key data \u0026allow-other-keys)\n                (message \"I sent: %S\" (assoc-default 'json data)))))\n\nAnother PUT JSON example (nested JSON using alist structure, how to represent a boolean \u0026 how to selectively evaluate lisp):\n\n.. code:: emacs-lisp\n\n  ;; (1) Prepend alist structure with a backtick (`) rather than single quote (')\n  ;;     to allow elisp evaluation of selected elements prefixed with a comma (,)\n  ;; (2) This value is expected as a boolean so use the nil / t elisp alist denotation\n  ;; (3) The function will be evaluated as it has been prefixed with a comma (,)\n  (request \"http://httpbin.org/put\"\n    :type \"PUT\"\n    :data (json-encode `((\"jsonArray\" . ((\"item1\" . \"value 1\") ;; (1)\n                                         (\"item2\" . t)         ;; (2)\n                                         (\"item3\" . ,(your-custom-elisp-function)))))) ;; (3)\n    :headers '((\"Content-Type\" . \"application/json\"))\n    :parser 'json-read\n    :success (cl-function\n              (lambda (\u0026key data \u0026allow-other-keys)\n                (message \"I sent: %S\" (assoc-default 'json data)))))\n\nGET with Unix domain socket data:\n\n.. code:: emacs-lisp\n\n  (request \"http:/hello.txt\"\n    :unix-socket \"/tmp/app.sock\"\n    :parser (lambda () (buffer-string))\n    :success (cl-function\n              (lambda (\u0026key data \u0026allow-other-keys)\n                (message \"Got: %s\" data))))\n\n\nLegacy documentation\n====================\n* `Github Pages \u003chttps://tkf.github.io/emacs-request/\u003e`\n\n.. |build-status|\n   image:: https://github.com/tkf/emacs-request/workflows/CI/badge.svg\n   :target: https://github.com/tkf/emacs-request/actions\n   :alt: Build Status\n.. |melpa-badge|\n   image:: http://melpa.org/packages/request-badge.svg\n   :target: http://melpa.org/#/request\n   :alt: MELPA Badge\n.. |melpa-stable-badge|\n   image:: http://stable.melpa.org/packages/request-badge.svg\n   :target: http://stable.melpa.org/#/request\n   :alt: MELPA Stable Badge\n.. _Getting started: http://melpa.org/#/getting-started\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkf%2Femacs-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkf%2Femacs-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkf%2Femacs-request/lists"}