Structures

Data structures used in Raider.

class DataStore(data)[source]

Class defining a dictionary-like data structure.

This class was created to hold information relevant to Raider in a structure similar to Python dictionaries.

__init__(data)[source]

Initializes the DataStore object.

Given a dictionary with the data, store them in this object.

Parameters

data (Optional[Dict[Any, Any]]) – A dictionary with Any elements to be stored.

__getitem__(key)[source]

Getter to return an element with the key.

Return type

Any

__setitem__(key, value)[source]

Setter to add a new element to DataStore.

Return type

None

__iter__()[source]

Iterator to yield the keys.

Return type

Iterator[Any]

__next__()[source]

Iterator to get the next element.

Return type

Any

update(data)[source]

Updates the DataStore with a new element.

Return type

None

pop(name)[source]

Pops an element from the DataStore.

Return type

Any

keys()[source]

Returns a list of the keys in the DataStore.

Return type

List[Any]

values()[source]

Returns a list of the values in the DataStore.

Return type

List[Any]

to_dict()[source]

Returns the DataStore elements as a dictionary.

Return type

Dict[Any, Any]

items()[source]

Returns a list of tuples containing the keys and values.

Return type

List[Tuple[Any, Any]]

class HeaderStore(data)[source]

Class storing the HTTP headers.

This class inherits from DataStore, and converts the values into Header objects.

__init__(data)[source]

Initializes the HeaderStore object.

Creates a HeaderStore object out of the given Header list.

Parameters

data (Optional[List[Header]]) – A list of Header objects to store.

set(header)[source]

Sets the value of a Header.

Given a Header object, add or update its value in the HeaderStore.

Parameters

header (Header) – A Header object to be added to the HeaderStore.

Return type

None

merge(headerstore)[source]

Merge HeaderStore object with another one.

Return type

None

classmethod from_dict(data)[source]

Creates a HeaderStore object from a dictionary.

Given a dictionary with header values, creates a HeaderStore object and returns it.

Parameters

data (Optional[Dict[str, str]]) – A dictionary with header values. Those will be mapped in Header objects.

Return type

HeaderStore

Returns

A HeaderStore object containing the headers created from the supplied dictionary.

class CookieStore(data)[source]

Class storing the HTTP cookies.

This class inherits from DataStore, and converts the values into Cookie objects.

__init__(data)[source]

Initializes a CookieStore object.

Given a list of Cookie objects, create the CookieStore containing them.

Parameters

data (Optional[List[Cookie]]) – A list of Cookies to be added to the CookieStore.

set(cookie)[source]

Sets the value of a Cookie.

Given a Cookie object, add or update its value in the CookieStore.

Parameters

cookie (Cookie) – A Cookie object to be added to the CookieStore

Return type

None

merge(cookiestore)[source]

Merge CookieStore object with another one.

Return type

None

classmethod from_dict(data)[source]

Creates a CookieStore object from a dictionary.

Given a dictionary with cookie values, creates a CookieStore object and returns it.

Parameters

data (Optional[Dict[str, str]]) – A dictionary with cookie values. Those will be mapped in Cookie objects.

Return type

CookieStore

Returns

A CookieStore object containing the cookies created from the supplied dictionary.