Safe Haskell | None |
---|---|
Language | Haskell2010 |
Retrieves documents for a URL, supporting multiple URL schemes that can be disabled at build-time for reduced dependencies.
Synopsis
- data Session
- newSession :: IO Session
- fetchURL :: Session -> [String] -> URI -> IO (String, Either Text ByteString)
- fetchURL' :: Session -> [String] -> URI -> IO (URI, String, Either Text ByteString)
- fetchURLs :: Session -> [String] -> [URI] -> ((URI, String, Either Text ByteString) -> IO a) -> IO [(URI, a)]
- mimeERR :: String
- htmlERR :: String
- dispatchByMIME :: Session -> String -> URI -> IO (Maybe String)
- appsForMIME :: Session -> String -> IO [Application]
- data Application = Application {}
- dispatchByApp :: Session -> Application -> String -> URI -> IO Bool
- saveDownload :: URI -> FilePath -> (URI, String, Either Text ByteString) -> IO URI
- downloadToURI :: (URI, String, Either Text ByteString) -> URI
- data LogRecord = LogRecord {}
- enableLogging :: Session -> IO Session
- retrieveLog :: Session -> IO [LogRecord]
- writeLog :: Handle -> Session -> IO ()
Documentation
newSession :: IO Session Source #
Initializes a default Session object to support HTTPS & Accept-Language if HTTP is enabled.
:: Session | The session of which this request is a part. |
-> [String] | The expected MIMEtypes in priority order. |
-> URI | The URL to retrieve |
-> IO (String, Either Text ByteString) | The MIMEtype & possibly text-decoded response. |
Retrieves a URL-identified resource & it's MIMEtype, possibly decoding it's text.
fetchURL' :: Session -> [String] -> URI -> IO (URI, String, Either Text ByteString) Source #
As per fetchURL
, but also returns the redirected URI.
fetchURLs :: Session -> [String] -> [URI] -> ((URI, String, Either Text ByteString) -> IO a) -> IO [(URI, a)] Source #
Concurrently fetch given URLs.
appsForMIME :: Session -> String -> IO [Application] Source #
data Application Source #
Instances
Show Application Source # | |
Defined in Network.URI.Types showsPrec :: Int -> Application -> ShowS # show :: Application -> String # showList :: [Application] -> ShowS # |
dispatchByApp :: Session -> Application -> String -> URI -> IO Bool Source #
saveDownload :: URI -> FilePath -> (URI, String, Either Text ByteString) -> IO URI Source #
write download to a file in the given directory.
downloadToURI :: (URI, String, Either Text ByteString) -> URI Source #
Convert a download into a data: URI