packages feed

antigate 2.0 → 2.0.1

raw patch · 2 files changed

+14/−12 lines, 2 filesdep +exceptionsdep +http-clientdep −http-client-multipart

Dependencies added: exceptions, http-client

Dependencies removed: http-client-multipart

Files

Text/Recognition/Antigate.hs view
@@ -90,6 +90,7 @@  import Control.Concurrent (threadDelay) import Control.Exception (Exception, throwIO)+import Control.Monad.Catch (MonadThrow) import Data.Typeable (Typeable)  import Control.Failure@@ -115,7 +116,7 @@ httpLbs :: MonadIO m => Request -> Manager -> m (Response BL.ByteString) httpLbs r = HC.httpLbs r{responseTimeout=Just __RESPONSE_TIMEOUT} -httpGet :: (Failure HttpException m, MonadIO m) => Manager -> String -> m BL.ByteString+httpGet :: (Failure HttpException m, MonadIO m, MonadThrow m) => Manager -> String -> m BL.ByteString httpGet m u = do     rq <- parseUrl u     responseBody `liftM` httpLbs rq m@@ -255,7 +256,7 @@ -- | report bad captcha result -- -- throws 'HttpException' on network errors.-reportBad :: (Failure HttpException m, MonadIO m) => ApiKey -> CaptchaID -> Manager -> m Bool+reportBad :: (Failure HttpException m, MonadIO m, MonadThrow m) => ApiKey -> CaptchaID -> Manager -> m Bool reportBad ApiKey{..} captchaid m = do     lbs <- httpGet m $         "http://" ++ api_host ++ "/res." ++ hostExt api_host ++ "?key=" ++@@ -265,13 +266,13 @@ -- | retrieve your current account balance -- -- throws 'HttpException' on network errors.-getBalance :: (Failure HttpException m, MonadIO m) => ApiKey -> Manager -> m Double+getBalance :: (Failure HttpException m, MonadIO m, MonadThrow m) => ApiKey -> Manager -> m Double getBalance ApiKey{..} m =     liftM (read . TL.unpack . decodeUtf8) $ httpGet m $         "http://"++ api_host ++ "/res." ++ hostExt api_host ++ "?key=" ++             api_key ++"&action=getbalance" -uploadReq :: (Failure HttpException m, MonadIO m) => Manager -> ApiKey -> CaptchaConf -> Part -> m (ApiResult CaptchaID)+uploadReq :: (Failure HttpException m, MonadIO m, MonadThrow m) => Manager -> ApiKey -> CaptchaConf -> Part -> m (ApiResult CaptchaID) uploadReq m ApiKey{..} conf part = do     url <- parseUrl $ "http://" ++ api_host ++ "/in." ++ hostExt api_host     req <- flip formDataBody url $@@ -286,7 +287,7 @@ -- -- throws 'HttpException' on network errors. uploadCaptcha-    :: (Failure HttpException m, MonadIO m)+    :: (Failure HttpException m, MonadIO m, MonadThrow m)     => ApiKey     -> CaptchaConf     -> FilePath@@ -297,7 +298,7 @@     uploadReq m key sets $ partFileRequestBody "file" filename $ RequestBodyLBS image  uploadCaptchaFromFile-    :: (Failure HttpException m, MonadIO m)+    :: (Failure HttpException m, MonadIO m, MonadThrow m)     => ApiKey     -> CaptchaConf     -> FilePath@@ -343,7 +344,7 @@ -- -- throws 'HttpException' on network errors. checkCaptcha-    :: (Failure HttpException m, MonadIO m)+    :: (Failure HttpException m, MonadIO m, MonadThrow m)     => ApiKey     -> CaptchaID     -> Manager@@ -357,7 +358,7 @@ -- -- throws 'HttpException' on network errors. checkCaptchas-    :: (Failure HttpException m, MonadIO m)+    :: (Failure HttpException m, MonadIO m, MonadThrow m)     => ApiKey     -> [CaptchaID]     -> Manager@@ -431,7 +432,7 @@ -- -- throws 'SolveException' or 'HttpException' when something goes wrong. solveCaptcha-    :: (Failure HttpException m, MonadIO m)+    :: (Failure HttpException m, MonadIO m, MonadThrow m)     => SolveConf     -> ApiKey     -> CaptchaConf@@ -469,7 +470,7 @@             ex -> liftIO $ throwIO $ SolveExceptionCheck captchaid $ () <$ ex  solveCaptchaFromFile-    :: (Failure HttpException m, MonadIO m)+    :: (Failure HttpException m, MonadIO m, MonadThrow m)     => SolveConf     -> ApiKey     -> CaptchaConf
antigate.cabal view
@@ -1,5 +1,5 @@ name: antigate-version: 2.0+version: 2.0.1 synopsis: Interface for antigate.com captcha recognition API description:     Haskell interface for antigate.com captcha recognition service@@ -22,8 +22,9 @@ library     build-depends: base >= 4 && < 5                   ,http-conduit >= 2 && < 3-                  ,http-client-multipart < 1+                  ,http-client >= 0.3.1                   ,bytestring+                  ,exceptions                   ,text                   ,data-default                   ,safe