Last active
May 16, 2019 16:25
-
-
Save fixxer/0759e08f8d74aa0770b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns fixxer.dadata | |
(:require [clj-http.client :as http] | |
[cheshire.core :as json])) | |
(def api-key "your-api-key") | |
(def secret-key "your-secret-key") | |
(defn clean [request] | |
(->> request | |
json/generate-string | |
(assoc {:content-type :json | |
:headers {"Authorization" (str "Token " api-key) | |
"X-Secret" secret-key}} :body) | |
(http/post "https://dadata.ru/api/v2/clean") | |
:body | |
json/parse-string)) | |
(let [request {:structure ["ADDRESS"] | |
:data [["Москва, Милютинский 13"]]}] | |
(println (clean request))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment