<commit_before>(ns karmanaut.client
  (:require [clj-http.client :as client])
  (:require [clojure.data.json :as json]))

(defn url [username]
  (str "http://www.reddit.com/user/" username "/about.json"))

(defn resp [username]
  (client/get (url username)))

(defn body [username]
  (json/read-str (:body (resp username))))

(defn items [username]
  ((body username) "items"))

(defn user-data [username]
  ((items username) 0))

(defn user-key [username data-key]
  ((user-data username) data-key))

(defn display-name [username]
  (user-key username "display_name"))

(defn rep [username]
  (user-key username "reputation"))<commit_msg>Fix client functions to work with Reddit API<commit_after>(ns karmanaut.client
  (:require [clj-http.client :as client])
  (:require [clojure.data.json :as json]))

(defn url [username]
  (str "http://www.reddit.com/user/" username "/about.json"))

(defn resp [username]
  (client/get (url username)))

(defn body [username]
  (json/read-str (:body (resp username))))

(defn user-data [username]
  ((body username) "data"))

(defn user-key [username data-key]
  ((user-data username) data-key))

(defn link-karma [username]
  (user-key username "link_karma"))

(defn comment-karma [username]
  (user-key username "comment_karma"))
{'fraction_non_alphanumeric': 0.17257683215130024, 'fraction_numerical': 0.0007880220646178094, 'mean_word_length': 4.669642857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4406723', 'n_tokens_mistral': 452, 'n_tokens_neox': 445, 'n_words': 122}