polyfemos.front.trafficmonitor.IPStorage

class polyfemos.front.trafficmonitor.IPStorage[source]

Bases: object

A class which handles IP addresses of the users

Every instance of the class uses the same file to save the IP addresses.

Public Methods

__init__()[source]

Clears the ipstorage file

add(ip)[source]
Parameters

ip (str) – IP address to be added to the ipstorage

append(str_)[source]
Parameters

str_ (str) – A string to be appended into the ipstorage file

clear()[source]

Clears the ipstorage file

has_ip(ip)[source]
Parameters

ip (str) – IP address

Return type

bool

Returns

True if ipstorage has the given ip

remove(ip)[source]
Parameters

ip (str) – an IP address to be removed from the ipstorage

write(str_)[source]
Parameters

str_ (str) – A string to be written into the ipstorage file

Special Methods

__iter__()[source]
Return type

generator

Returns

all IP addresses stored in the ipstrorage file

__str__()[source]
Return type

str

Returns

A list of all IP addresses stored in the ipstorage file.