woob.capabilities.contact

class ProfileNode(name, label, value, sufix=None, flags=0)[source]

Bases: object

Node of a Contact profile.

HEAD = 1
SECTION = 2
class ContactPhoto(name, url=None)[source]

Bases: BaseObject

Photo of a contact.

Variables:
  • url – (str) url

  • name – (str) Name of the photo

  • data – (bytes) Data of photo

  • thumbnail_url – (str) Direct URL to thumbnail

  • thumbnail_data – (bytes) Data of thumbnail

  • hidden – (bool) True if the photo is hidden on website

class Contact(id, name, status, url=None)[source]

Bases: BaseContact

A contact.

Variables:
  • url – (str) url

  • name – (str) Name of contact

  • phone – (str) Phone number

  • email – (str) Contact email

  • website – (str) Website URL of the contact

  • status – (int) Status of contact (STATUS_* constants)

  • status_msg – (str) Message of status

  • summary – (str) Description of contact

  • photos – (dict) List of photos (default: OrderedDict())

  • profile – (dict) Contact profile (default: OrderedDict())

STATUS_ONLINE = 1
STATUS_AWAY = 2
STATUS_OFFLINE = 4
STATUS_ALL = 4095
set_photo(name, **kwargs)[source]

Set photo of contact.

Parameters:
  • name (str) – name of photo

  • kwargs – See ContactPhoto to know what other parameters you can use

get_text()[source]
exception QueryError[source]

Bases: UserError

Raised when unable to send a query to a contact.

class Query(id, message, url=None)[source]

Bases: BaseObject

Query to send to a contact.

Variables:
  • url – (str) url

  • message – (str) Message received

class CapContact[source]

Bases: Capability

iter_contacts(status=Contact.STATUS_ALL, ids=None)[source]

Iter contacts

Parameters:
  • status (Contact.STATUS_*) – get only contacts with the specified status (default: Contact.STATUS_ALL)

  • ids (list[str]) – if set, get the specified contacts (default: None)

Return type:

iter[Contact]

get_contact(id)[source]

Get a contact from his id.

The default implementation only calls iter_contacts() with the proper values, but it might be overloaded by backends.

Parameters:

id (str) – the ID requested

Return type:

Contact or None if not found

send_query(id)[source]

Send a query to a contact

Parameters:

id (str) – the ID of contact

Return type:

Query

Raises:

QueryError

get_notes(id)[source]

Get personal notes about a contact

Parameters:

id (str) – the ID of the contact

Return type:

str

save_notes(id, notes)[source]

Set personal notes about a contact

Parameters:

id (str) – the ID of the contact

Returns:

the str object to save as notes

class BaseContact(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject

This is the blase class for a contact.

Variables:
  • url – (str) url

  • name – (str) Name of contact

  • phone – (str) Phone number

  • email – (str) Contact email

  • website – (str) Website URL of the contact

class PhysicalEntity(id='', url=NotLoaded, backend=None)[source]

Bases: BaseContact

Contact which has a physical address.

Variables:
  • url – (str) url

  • name – (str) Name of contact

  • phone – (str) Phone number

  • email – (str) Contact email

  • website – (str) Website URL of the contact

  • postal_address – (PostalAddress) Postal address

  • address_notes – (str) Extra address info

property country
property postcode
property city
property address
class Person(id='', url=NotLoaded, backend=None)[source]

Bases: PhysicalEntity

Variables:
  • url – (str) url

  • name – (str) Name of contact

  • phone – (str) Phone number

  • email – (str) Contact email

  • website – (str) Website URL of the contact

  • postal_address – (PostalAddress) Postal address

  • address_notes – (str) Extra address info

class Place(id='', url=NotLoaded, backend=None)[source]

Bases: PhysicalEntity

Variables:
  • url – (str) url

  • name – (str) Name of contact

  • phone – (str) Phone number

  • email – (str) Contact email

  • website – (str) Website URL of the contact

  • postal_address – (PostalAddress) Postal address

  • address_notes – (str) Extra address info

  • opening – (OpeningHours) Opening hours

class OpeningHours(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject

Definition of times when a place is open or closed.

Consists in a list of OpeningRule. Rules should be ordered by priority. If no rule matches the given date, it is considered closed by default.

Variables:
  • url – (str) url

  • rules – (list) Rules of opening/closing

is_open_at(query)[source]
property is_open_now
class OpeningRule(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject

Single rule defining a (recurrent) time interval when a place is open or closed.

Variables:
  • url – (str) url

  • dates – (rrulebase) Dates on which this rule applies

  • times – (list) Times of the day this rule applies

  • is_open – (bool) Is it an opening rule or closing rule?

class RRuleField(doc, **kargs)[source]

Bases: Field

convert(v)[source]

Convert value to the wanted one.

class CapDirectory[source]

Bases: Capability

search_contacts(query, sortby)[source]

Search contacts matching a query.

Parameters:

query (SearchQuery) – search parameters

Return type:

iter[PhysicalEntity]