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