geolocate.classes.config module¶
Configuration parser module.
Programmed by: Dante Signal31
email: dante.signal31@gmail.com
-
exception
geolocate.classes.config.ConfigNotFound[source]¶ Bases:
ExceptionLaunched when config file is not where is supposed to be.
-
class
geolocate.classes.config.Configuration(user_id='', license_key='', download_url='http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz', update_interval=35, local_database_folder='/home/dante/Developments/geolocate/geolocate/local_database/', local_database_name='GeoLite2-City.mmdb', locators_preference=['geoip2_webservice', 'geoip2_local'])[source]¶ Bases:
objectClass to encapsulate configuration needed to connect to Geolite2 webservices or downloaded local database. This class also validates parameters read from config files to overcome user typos.
-
__init__(user_id='', license_key='', download_url='http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz', update_interval=35, local_database_folder='/home/dante/Developments/geolocate/geolocate/local_database/', local_database_name='GeoLite2-City.mmdb', locators_preference=['geoip2_webservice', 'geoip2_local'])[source]¶
-
disabled_locators¶ Locators registered as default one but not enabled in this GeoIPDatabase.
Returns: Disabled locators in this GeoIPDatabase. Return type: set
-
download_url¶
-
license_key¶
-
local_database_folder¶
-
local_database_name¶
-
local_database_path¶
-
locators_preference¶ Returns: Enabled locators for this GeoIPDatabase ordered by preference. Return type: list
-
update_interval¶
-
user_id¶
-
-
class
geolocate.classes.config.OpenConfigurationToUpdate[source]¶ Bases:
objectContext manager to get a configuration file and save it automatically.
-
exception
geolocate.classes.config.ParameterNotValid(provided_value, parameter, message)[source]¶ Bases:
ExceptionLaunched when user_id validation fails.
-
exception
geolocate.classes.config.UnknownLocators(unknown_locators)[source]¶ Bases:
ExceptionRaised when an still not implemented location is referenced in any operation.
-
geolocate.classes.config.load_configuration()[source]¶ Read configuration file and populate with its data a config.Configuration instance.
Returns: Configuration instance populated with configuration file data. Return type: config.Configuration
-
geolocate.classes.config.save_configuration(configuration)[source]¶ Write Configuration object in config file.
Parameters: configuration (config.Configuration) – Configuration to be saved. Returns: None