Created
March 2, 2020 15:58
-
-
Save kyptin/202370fe619507cf4f3c88f79020eaee to your computer and use it in GitHub Desktop.
Fetch commit author frequences from the GitHub API (COMP 590 in-class exercise)
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 commits | |
(:require [clj-http.client :as http] | |
[clj-json.core :as json] | |
[clojure.pprint :refer [pprint]])) | |
(def api-url "https://api.github.com/repos/clojure/clojure/commits") | |
(defn get-committers-from-page [n] | |
(some->> (http/get api-url {:query-params {"per_page" 100, "page" n}}) | |
:body | |
json/parse-string | |
(map #(get-in % ["author" "login"])) | |
(remove nil?))) | |
(defn -main [] | |
(->> (get-committers-from-page 1) | |
frequencies | |
(sort-by val) | |
pprint)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment