woob.exceptions

exception BrowserIncorrectPassword(message='', bad_fields=None)[source]

Bases: Exception

The site signals to us our credentials are invalid.

Parameters:
  • message (str) – compatibility message for the user (mostly when bad_fields is not given) (default: "")

  • bad_fields (List[str] | None) – list of config field names which are incorrect, if it is known (default: None)

exception BrowserForbidden[source]

Bases: Exception

The site signals to us that access to a resource is forbidden.

exception BrowserUserBanned(message='', bad_fields=None)[source]

Bases: BrowserIncorrectPassword

The site signals to us the user we are logging in as is banned.

Parameters:
  • message (str) – compatibility message for the user (mostly when bad_fields is not given) (default: "")

  • bad_fields (List[str] | None) – list of config field names which are incorrect, if it is known (default: None)

exception BrowserUnavailable[source]

Bases: Exception

The site is either momentarily unavailable, or in maintenance.

exception ScrapingBlocked[source]

Bases: BrowserUnavailable

The site has detected scraping, and signals that it has blocked it.

exception BrowserInteraction[source]

Bases: Exception

Base class for most browser interactions.

exception BrowserQuestion(*fields)[source]

Bases: BrowserInteraction

The site requires values to be provided by the end user.

Parameters:

fields – The Value objects to be provided by the end user.

exception OTPQuestion(*fields)[source]

Bases: BrowserQuestion

The site requires transient values to be provided by the end user.

Parameters:

fields – The Value objects to be provided by the end user.

class OTPSentType[source]

Bases: object

UNKNOWN = 'unknown'
SMS = 'sms'
MOBILE_APP = 'mobile_app'
EMAIL = 'email'
DEVICE = 'device'
exception SentOTPQuestion(field_name, medium_type=OTPSentType.UNKNOWN, medium_label=None, message='', expires_at=None)[source]

Bases: OTPQuestion

A one-time password sent to one of the end user’s device is required.

For example, the site has sent an SMS including a one-time password to a phone number associated with the end user, and we need to ask the end user to provide this code to us to send it back to the site.

Parameters:
  • field_name (str) – name of the config field in which the OTP shall be given to the module

  • medium_type (str) – if known, where the OTP was sent (default: OTPSentType.UNKNOWN)

  • medium_label (str | None) – if known, label of where the OTP was sent, (default: None) e.g. the phone number in case of an SMS

  • message (str) – compatibility message (used as the Value label) (default: "")

  • expires_at (datetime | None) – date when the OTP expires and when replying is too late (default: None)

exception OfflineOTPQuestion(field_name, input=None, medium_label=None, message='', expires_at=None)[source]

Bases: OTPQuestion

A one-time password generated by the end user is required.

For example, the site requires a one-time password generated by an RFC 6238 compliant application, such as Google Authenticator, to be provided, so this exception gets raised to obtain one we can send back to the site.

Parameters:
  • field_name (str) – name of the config field in which the OTP shall be given to the module

  • input (str | None) – if relevant, input data for computing the OTP (default: None)

  • message (str) – compatibility message (used as the Value label) (default: "")

  • medium_label (str | None) – if known, label of the device to use for generating (default: None) or reading the OTP, e.g. the card index for paper OTP

  • expires_at (datetime | None) – date when the OTP expires and when replying is too late (default: None)

class DecoupledMedium[source]

Bases: object

UNKNOWN = 'unknown'
SMS = 'sms'
MOBILE_APP = 'mobile_app'
EMAIL = 'email'
exception DecoupledValidation(message='', resource=None, medium_type=DecoupledMedium.UNKNOWN, medium_label=None, expires_at=None, *values)[source]

Bases: BrowserInteraction

A validation of the current action is requested on a separate channel.

For example, the site requires the user to click on a link sent in an e-mail to pursue logging in on the current session.

Parameters:
  • medium_type (str) – if known, where the decoupled validation was sent (default: DecoupledMedium.UNKNOWN)

  • medium_label (str | None) – if known, label of where the decoupled validation was (default: None) sent, e.g. the phone number in case of an app

  • expires_at (datetime | None) – date when the OTP expires and when replying is too late (default: None)

exception AppValidation(*args, **kwargs)[source]

Bases: DecoupledValidation

A validation of the current action is requested in a mobile application.

For example, the site requires the user to open the mobile application corresponding to the site, enter a specific password to the application, and click on “Validate” for the current operation to be validated.

Parameters:
  • medium_label (str) – if known, label of where the decoupled validation was sent, e.g. the phone number in case of an app

  • expires_at (datetime.datetime) – date when the OTP expires and when replying is too late

exception AppValidationError[source]

Bases: Exception

The mobile application validation has failed for a generic reason.

exception AppValidationCancelled[source]

Bases: AppValidationError

The mobile application validation has been cancelled.

This usually happens when the end user has selected “Deny” or “Cancel” instead of “Validate” in their mobile application.

exception AppValidationExpired[source]

Bases: AppValidationError

The mobile application validation has expired.

This usually happens when the end user hasn’t selected any option, logged into their mobile application in time to select any option, or if they have given up consenting to the operation and the application doesn’t have a “Deny” option.

exception BrowserRedirect(url, resource=None)[source]

Bases: BrowserInteraction

The site requires the end user to do a webauth redirect flow.

The exception specifies the URL to redirect the user to. At the end of the process, i.e. when the end user has been redirected to the callback URI with parameters, the ‘auth_uri’ configuration value should be set to the callback URI with parameters for processing by the module.

Parameters:

url (str) – The URL to redirect the end user to.

exception CaptchaQuestion(type=None, **kwargs)[source]

Bases: Exception

The site requires solving a CAPTCHA (base class).

The response to the captcha should be set, as text, to the ‘captcha_response’ configuration value.

Parameters:

type (str | None) – The type of captcha, as a string. (default: None)

exception WrongCaptchaResponse(message=None)[source]

Bases: Exception

The site signals to us that our captcha response is incorrect.

exception BrowserHTTPNotFound[source]

Bases: Exception

exception BrowserHTTPError[source]

Bases: Exception

exception BrowserHTTPSDowngrade[source]

Bases: Exception

exception BrowserSSLError[source]

Bases: BrowserUnavailable

exception ParseError[source]

Bases: Exception

exception FormFieldConversionWarning[source]

Bases: UserWarning

A value has been set to a form’s field and has been implicitly converted.

exception ModuleInstallError[source]

Bases: Exception

exception ModuleLoadError(module_name, msg)[source]

Bases: Exception

class ActionType[source]

Bases: object

ACKNOWLEDGE = 1

Must acknowledge new Terms of Service or some important message

FILL_KYC = 2

User information must be filled on website

ENABLE_MFA = 3

MFA must be enabled on website

PERFORM_MFA = 4

Must perform MFA on website directly to unlock scraping

It is different from DecoupledValidation.

PAYMENT = 5

Must pay site for the feature or pay again for the subscription which has ended

CONTACT = 6

Must contact site support or a customer relation person for another problem

The problem should ideally be described in ActionNeeded.message.

exception ActionNeeded(message=None, *, locale=None, action_type=None, url=None, page=None)[source]

Bases: Exception

An action must be performed directly, often on website.

Parameters:
  • message (str) – message from the site (default: None)

  • locale (str) – ISO4646 language tag of message (e.g. “en-US”) (default: None)

  • action_type (int | None) – type of action to perform (default: None)

  • url (str) – URL of the page to go to resolve the action needed (default: None)

  • page (str) – user hint for when no URL can be given and the place where to perform the action is not obvious (default: None)

exception AuthMethodNotImplemented(message=None, *, locale=None, action_type=None, url=None, page=None)[source]

Bases: ActionNeeded

Website requires a kind of authentication that is not implemented.

exception BrowserPasswordExpired(message=None, *, locale=None, action_type=None, url=None, page=None)[source]

Bases: ActionNeeded

Credentials are expired, user has to go on website to update them.

exception NeedInteractive[source]

Bases: Exception

Require an interactive call by user.

This may be raised when a method is called by a background job, without a user.

exception NeedInteractiveForRedirect[source]

Bases: NeedInteractive

Require an interactive call by user to perform a redirect.

exception NeedInteractiveFor2FA[source]

Bases: NeedInteractive

Require an interactive call by user to perform a 2FA.

exception NotImplementedWebsite(*args, **kwargs)[source]

Bases: NotImplementedError

Exception for modules when a website is not yet available.