From 6413be54098833a0f9b26334d0eeb5fc9a191d92 Mon Sep 17 00:00:00 2001 From: emacsist Date: Wed, 22 Mar 2017 19:02:05 +0800 Subject: [add] add HTTP request header: Accept-Language, display different language. --- wttrin.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wttrin.el b/wttrin.el index a8d9b85..c92ff1d 100644 --- a/wttrin.el +++ b/wttrin.el @@ -27,9 +27,16 @@ :group 'wttrin :type 'list) +(defcustom wttrin-default-accept-language '("Accept-Language" . "en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4") + "Specify default HTTP request Header for Accept-Language." + :group 'wttrin + :type '(list) + ) + (defun wttrin-fetch-raw-string (query) "Get the weather information based on your QUERY." (let ((url-request-extra-headers '(("User-Agent" . "curl")))) + (add-to-list 'url-request-extra-headers wttrin-default-accept-language) (with-current-buffer (url-retrieve-synchronously (concat "http://wttr.in/" query) -- cgit v1.2.3