Skip to content

Instantly share code, notes, and snippets.

@fixxer
Last active May 16, 2019 16:25
Show Gist options
  • Save fixxer/0759e08f8d74aa0770b0 to your computer and use it in GitHub Desktop.
Save fixxer/0759e08f8d74aa0770b0 to your computer and use it in GitHub Desktop.
(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