UrlPool

class UrlPool(name, urls, *, strip_slash=True, ttl=3600)[source]

Pool of possible urls which provides easy access to a working one.

name

Name given to the pool

Type

str

urls

List of the possible urls

Type

List[str]

strip_slash

Whether or not tailing slashes should be removed

Type

bool

ttl

Time until the current url expires

Type

timedelta

coroutine fetch(self)[source]

Get the current url from the database.

Return type

None

name
Return type

str

needs_update

Whether the current url is outdated.

Return type

bool

prepare_url(url)[source]

Prepare an url to be used as the current url.

This function is performed for all urls returned by url

Return type

str

coroutine update_url(self)[source]

Search for a working url.

This is automatically called.

Return type

None

coroutine upload(self)[source]

Upload the current url to the database.

Return type

None

url

Current url.

Return type

str