-
-
Save sshine/fd27702785b50f401e088134dc77ca61 to your computer and use it in GitHub Desktop.
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
-- curl -v -u "$CVR_USER:$CVR_PASS" -H "Content-Type: application/json" -XPOST "$URL" -d"$QUERY" | |
searchReq :: SearchQuery -> IO () | |
searchReq searchQuery = do | |
cvrUser <- Env.getEnv "CVR_USER" | |
cvrPass <- Env.getEnv "CVR_PASS" | |
runReq tmpHttpConfig $ do | |
let payload = toJSON searchQuery | |
r <- req POST (https "distribution.virk.dk" /: "/cvr-permanent/virksomhed/_search") | |
(ReqBodyJson payload) | |
bsResponse -- jsonResponse | |
(basicAuth (BS.pack cvrUser) (BS.pack cvrPass)) | |
-- liftIO $ print (responseBody r :: Value) | |
liftIO $ print (responseBody r :: ByteString) | |
where | |
tmpHttpConfig = defaultHttpConfig | |
{ httpConfigRetryPolicy = tmpRetryPolicy | |
} | |
tmpRetryPolicy :: (Monad m) => RetryPolicyM m | |
tmpRetryPolicy = Retry.constantDelay 50 <> Retry.limitRetries 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment