Adds retries to login
This commit is contained in:
@@ -37,42 +37,48 @@
|
|||||||
(catch Exception e
|
(catch Exception e
|
||||||
(if (>= i 3)
|
(if (>= i 3)
|
||||||
(throw e)
|
(throw e)
|
||||||
(retry-thrice x (inc i)))))))
|
(do
|
||||||
|
(Thread/sleep 5000)
|
||||||
|
(retry-thrice x (inc i))))))))
|
||||||
|
|
||||||
(def base-headers {"Api-Version" "1.1"
|
(def base-headers {"Api-Version" "1.1"
|
||||||
"Cobrand-Name" (:yodlee-cobrand-name env)
|
"Cobrand-Name" (:yodlee-cobrand-name env)
|
||||||
"Content-Type" "application/json"})
|
"Content-Type" "application/json"})
|
||||||
|
|
||||||
(defn login-cobrand []
|
(defn login-cobrand []
|
||||||
(-> (str (:yodlee-base-url env) "/cobrand/login")
|
(retry-thrice
|
||||||
(client/post (merge {:headers base-headers
|
(fn []
|
||||||
:body
|
(-> (str (:yodlee-base-url env) "/cobrand/login")
|
||||||
(json/write-str {:cobrand {:cobrandLogin (:yodlee-cobrand-login env)
|
(client/post (merge {:headers base-headers
|
||||||
:cobrandPassword (:yodlee-cobrand-password env)
|
:body
|
||||||
:locale "en_US"}})
|
(json/write-str {:cobrand {:cobrandLogin (:yodlee-cobrand-login env)
|
||||||
:as :json}
|
:cobrandPassword (:yodlee-cobrand-password env)
|
||||||
other-config)
|
:locale "en_US"}})
|
||||||
)
|
:as :json}
|
||||||
:body
|
other-config)
|
||||||
:session
|
)
|
||||||
:cobSession))
|
:body
|
||||||
|
:session
|
||||||
|
:cobSession))))
|
||||||
|
|
||||||
|
|
||||||
(defn login-user
|
(defn login-user
|
||||||
([cob-session] (login-user cob-session (:yodlee-user-login env) (:yodlee-user-password env)))
|
([cob-session] (login-user cob-session (:yodlee-user-login env) (:yodlee-user-password env)))
|
||||||
([cob-session user password]
|
([cob-session user password]
|
||||||
(-> (str (:yodlee-base-url env) "/user/login")
|
(retry-thrice
|
||||||
(client/post (merge {:headers (merge base-headers {"Authorization" (auth-header cob-session)})
|
(fn []
|
||||||
:body
|
(-> (str (:yodlee-base-url env) "/user/login")
|
||||||
(json/write-str {:user {:loginName user
|
(client/post (merge {:headers (merge base-headers {"Authorization" (auth-header cob-session)})
|
||||||
:password password
|
:body
|
||||||
:locale "en_US"}})
|
(json/write-str {:user {:loginName user
|
||||||
:as :json}
|
:password password
|
||||||
other-config))
|
:locale "en_US"}})
|
||||||
:body
|
:as :json}
|
||||||
:user
|
other-config))
|
||||||
:session
|
:body
|
||||||
:userSession))
|
:user
|
||||||
|
:session
|
||||||
|
:userSession))))
|
||||||
)
|
)
|
||||||
|
|
||||||
(defn get-accounts []
|
(defn get-accounts []
|
||||||
@@ -397,7 +403,6 @@
|
|||||||
batch-size 100]
|
batch-size 100]
|
||||||
|
|
||||||
(try
|
(try
|
||||||
|
|
||||||
(doto (-> (str (:yodlee-base-url env) "/providerAccounts?providerAccountIds=" pa)
|
(doto (-> (str (:yodlee-base-url env) "/providerAccounts?providerAccountIds=" pa)
|
||||||
|
|
||||||
(client/put (merge {:headers (merge base-headers {"Authorization" (auth-header cob-session user-session)})
|
(client/put (merge {:headers (merge base-headers {"Authorization" (auth-header cob-session user-session)})
|
||||||
|
|||||||
Reference in New Issue
Block a user