I'm trying to write a haskell program that accesses a https url, where a file is automatically downloaded. The site requests authentication. I tried using the Req library but I couldn't understand all the web and networking concepts.
Can anyone give me some template code or at least to tell me more precisely where i can find the functions I need?
This is the code I wrote so far, but is'n not working:
import Control.Monad
import Control.Monad.IO.Class
import Data.Aeson
import Data.Default.Class
import Data.Maybe (fromJust)
import Data.Monoid ((<>))
import Data.Text as T
import GHC.Generics
import Network.HTTP.Req
import qualified Data.ByteString.Char8 as B
main = runReq def $ do
let myMethod = GET
myUrl = https $ T.pack "https://..."
myBody = NoReqBody
myProxy = ignoreResponse
myOption = basicAuth (B.pack "user") (B.pack "password")
m <- req myMethod myUrl myBody myProxy myOption
return ()
Aucun commentaire:
Enregistrer un commentaire