Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Captcha = MkCaptcha {
- _options :: Options
- _partTexts :: [(Text, Text)]
- _partFiles :: [(Text, FilePath)]
- type TimeoutDuration = Integer
- type PollingInterval = Int
- type CaptchaId = Text
- captchaTimeout :: TimeoutDuration
- pollingInterval :: PollingInterval
- class Coercible Captcha a => HasCookies a where
- class Coercible Captcha a => HasUserAgent a where
- class Coercible Captcha a => HasLanguage a where
- class Coercible Captcha a => HasLocalImage a where
- class Coercible Captcha a => HasProxy a where
- class Coercible Captcha a => HasPageURL a where
- newtype CaptchaRes = CaptchaRes Captcha
- class Coercible Captcha a => HasCommonCaptchaLenses a where
- class Coercible Captcha a => HasCaptchaLenses a where
- options :: Lens' Captcha Options
- partFiles :: Lens' Captcha [(Text, FilePath)]
- partTexts :: Lens' Captcha [(Text, Text)]
- parts :: Getter Captcha [Part]
- mkPartFileLens :: Coercible Captcha a => Text -> Lens' a (Maybe FilePath)
- captchaRes :: CaptchaRes
- captchaId :: Lens' CaptchaRes (Maybe Text)
- module TwoCaptcha.Internal.Types.CapyCaptcha
- module TwoCaptcha.Internal.Types.CoordinateCaptcha
- module TwoCaptcha.Internal.Types.Exception
- module TwoCaptcha.Internal.Types.FunCaptcha
- module TwoCaptcha.Internal.Types.GeeTestCaptcha
- module TwoCaptcha.Internal.Types.GridCaptcha
- module TwoCaptcha.Internal.Types.HCaptcha
- module TwoCaptcha.Internal.Types.KeyCaptcha
- module TwoCaptcha.Internal.Types.NormalCaptcha
- module TwoCaptcha.Internal.Types.ReCaptcha
- module TwoCaptcha.Internal.Types.RotateCaptcha
- module TwoCaptcha.Internal.Types.TextCaptcha
- module TwoCaptcha.Internal.Types.TikTokCaptcha
- class TwoCaptchaClient m where
- submit :: (Coercible Captcha a, HasCaptchaLenses a, HasCommonCaptchaLenses a) => Session -> a -> m CaptchaId
- answer :: Session -> CaptchaRes -> m Text
- solve :: (Coercible Captcha a, HasCaptchaLenses a, HasCommonCaptchaLenses a) => PollingInterval -> TimeoutDuration -> Session -> a -> m Text
Documentation
Represents the request information required to solve a captcha.
MkCaptcha | |
|
type TimeoutDuration = Integer Source #
Time in milliseconds on when to timeout if the request takes too long.
type PollingInterval = Int Source #
Time in milliseconds in how often to request the answer.
captchaTimeout :: TimeoutDuration Source #
Default captcha timeout duration (120 seconds).
pollingInterval :: PollingInterval Source #
Default polling interval (10 seconds).
class Coercible Captcha a => HasCookies a where Source #
Nothing
cookies :: Lens' a (Maybe Text) Source #
Cookies that will be used by the worker solving the captcha. The used cookies will also be included in the response.
Format: KEY1:Value1;KEY2:Value2;
Instances
class Coercible Captcha a => HasUserAgent a where Source #
Nothing
userAgent :: Lens' a (Maybe Text) Source #
User agent that will be used by the worker when solving the captcha.
Instances
class Coercible Captcha a => HasLanguage a where Source #
Nothing
language :: Lens' a (Maybe Int) Source #
The captcha's language:
- Not specified.
- Cyrillic captcha.
- Latin captcha.
languageCode :: Lens' a (Maybe Text) Source #
The captcha's language code. Click here for a list of supported languages.
Instances
class Coercible Captcha a => HasLocalImage a where Source #
Nothing
file :: Lens' a (Maybe FilePath) Source #
File path of a captcha image.
body :: Lens' a (Maybe Text) Source #
Base-64 encoded image.
textInstructions :: Lens' a (Maybe Text) Source #
Text which is shown to the worker to help solve a captcha.
imgInstructions :: Lens' a (Maybe FilePath) Source #
Image file path with instructions on solving a captcha.
Instances
class Coercible Captcha a => HasProxy a where Source #
Nothing
proxy :: Lens' a (Maybe Text) Source #
Proxy to be sent to the worker who solves the captcha. You can read more about proxies here.
Format must be in login:password@123.123.123.123:3128 .
proxyType :: Lens' a (Maybe Text) Source #
Type of your proxy: HTTP, HTTPS, SOCKS4, SOCKS5.
Instances
class Coercible Captcha a => HasPageURL a where Source #
Nothing
Instances
newtype CaptchaRes Source #
Parameters used to retrieve the answer
of a solved captcha.
Instances
Show CaptchaRes Source # | |
Defined in TwoCaptcha.Internal.Types.Captcha showsPrec :: Int -> CaptchaRes -> ShowS # show :: CaptchaRes -> String # showList :: [CaptchaRes] -> ShowS # | |
HasCommonCaptchaLenses CaptchaRes Source # | |
Defined in TwoCaptcha.Internal.Types.Captcha apiKey :: Lens' CaptchaRes (Maybe Text) Source # headerACAO :: Lens' CaptchaRes (Maybe Bool) Source # |
class Coercible Captcha a => HasCommonCaptchaLenses a where Source #
Nothing
apiKey :: Lens' a (Maybe Text) Source #
Your 2captcha API key.
headerACAO :: Lens' a (Maybe Bool) Source #
If True, submit
will include the Access-Control-Allow-Origin:* header in the response.
Used for cross-domain AJAX requests in web applications.
Instances
class Coercible Captcha a => HasCaptchaLenses a where Source #
Lenses for constructing options for submit
.
Nothing
softId :: Lens' a (Maybe Int) Source #
Software developer id. Developers who integrate their software with 2captcha earn 10% of the user's spendings.
pingback :: Lens' a (Maybe Text) Source #
URL for pingback (callback) response that will be sent the answer to when the captcha is solved.
method :: Lens' a (Maybe Text) Source #
Type of captcha to solve.
Instances
parts :: Getter Captcha [Part] Source #
Convert the captcha's multipart form parameters into a [Part
].
mkPartFileLens :: Coercible Captcha a => Text -> Lens' a (Maybe FilePath) Source #
Create a lens using the given field name for multipart form files.
captchaRes :: CaptchaRes Source #
Parameters for retrieving a captcha's answer.
Required parameters:
Optional parameters:
class TwoCaptchaClient m where Source #
Encapsulates the in.php and res.php endpoints for the 2captcha API.
submit :: (Coercible Captcha a, HasCaptchaLenses a, HasCommonCaptchaLenses a) => Session -> a -> m CaptchaId Source #
Submit a captcha to be solved by the 2captcha API. Returns a captcha id used for answer
.
answer :: Session -> CaptchaRes -> m Text Source #
Attempt to retrieve the answer of a captcha previously submitted.
solve :: (Coercible Captcha a, HasCaptchaLenses a, HasCommonCaptchaLenses a) => PollingInterval -> TimeoutDuration -> Session -> a -> m Text Source #
Submits a captcha and polls for the answer.
Instances
(MonadIO m, MonadCatch m) => TwoCaptchaClient m Source # | |
Defined in TwoCaptcha.Internal.Client submit :: (Coercible Captcha a, HasCaptchaLenses a, HasCommonCaptchaLenses a) => Session -> a -> m CaptchaId Source # answer :: Session -> CaptchaRes -> m Text Source # solve :: (Coercible Captcha a, HasCaptchaLenses a, HasCommonCaptchaLenses a) => PollingInterval -> TimeoutDuration -> Session -> a -> m Text Source # |