polyfemos.front.trafficmonitor.IPStorage — polyfemos 0.3.29 documentation

# polyfemos.front.trafficmonitor.IPStorage

class `polyfemos.front.trafficmonitor.` `IPStorage`

  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__`()

    Clears the ipstorage file

  `add`(ip)
    Parameters

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

  `append`(str_)
    Parameters

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

  `clear`()

    Clears the ipstorage file

  `has_ip`(ip)
    Parameters

      ip (str) – IP address

    Return type

      bool

    Returns

      `True` if ipstorage has the given `ip`

  `remove`(ip)
    Parameters

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

  `write`(str_)
    Parameters

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

  Special Methods

  `__iter__`()
    Return type

      generator

    Returns

      all IP addresses stored in the ipstrorage file

  `__str__`()
    Return type

      str

    Returns

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