:py:mod:`GeoHealthCheck.models` =============================== .. py:module:: GeoHealthCheck.models Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: GeoHealthCheck.models.Run GeoHealthCheck.models.ProbeVars GeoHealthCheck.models.CheckVars GeoHealthCheck.models.Tag GeoHealthCheck.models.Recipient GeoHealthCheck.models.ResourceNotification GeoHealthCheck.models.Resource GeoHealthCheck.models.ResourceLock GeoHealthCheck.models.User Functions ~~~~~~~~~ .. autoapisummary:: GeoHealthCheck.models.flush_runs GeoHealthCheck.models._validate_webhook GeoHealthCheck.models._validate_email GeoHealthCheck.models.get_resource_types_counts GeoHealthCheck.models.get_resources_count GeoHealthCheck.models.get_runs_count GeoHealthCheck.models.get_runs_status_count GeoHealthCheck.models.get_first_run GeoHealthCheck.models.get_last_run GeoHealthCheck.models.get_last_run_per_resource GeoHealthCheck.models.get_tag_counts GeoHealthCheck.models.load_data GeoHealthCheck.models.db_commit Attributes ~~~~~~~~~~ .. autoapisummary:: GeoHealthCheck.models.APP GeoHealthCheck.models.DB GeoHealthCheck.models.LOGGER GeoHealthCheck.models.resource_tags GeoHealthCheck.models.APP .. py:data:: APP .. py:data:: DB .. py:data:: LOGGER .. py:function:: flush_runs() .. py:class:: Run(resource, result, checked_datetime=datetime.utcnow()) Bases: :py:obj:`DB` measurement of resource state .. py:property:: report .. py:attribute:: identifier .. py:attribute:: resource_identifier .. py:attribute:: resource .. py:attribute:: checked_datetime .. py:attribute:: success .. py:attribute:: response_time .. py:attribute:: message .. py:attribute:: report .. py:attribute:: _report .. py:method:: __lt__(other) .. py:method:: __le__(other) .. py:method:: __eq__(other) .. py:method:: __gt__(other) .. py:method:: __ge__(other) .. py:method:: __hash__() .. py:method:: __repr__() .. py:method:: for_json() .. py:class:: ProbeVars(resource_obj, probe_class, parameters={}) Bases: :py:obj:`DB` Identifies and parameterizes single Probe class. Probe instance applies to single parent Resource. .. py:property:: parameters .. py:property:: probe_instance .. py:property:: name .. py:property:: probe_parameters .. py:attribute:: identifier .. py:attribute:: resource_identifier .. py:attribute:: resource .. py:attribute:: probe_class .. py:attribute:: _parameters .. py:method:: __repr__() .. py:class:: CheckVars(probe_vars, check_class, parameters={}) Bases: :py:obj:`DB` Identifies and parameterizes check function, applies to single Probe .. py:property:: parameters .. py:attribute:: identifier .. py:attribute:: probe_vars_identifier .. py:attribute:: probe_vars .. py:attribute:: check_class .. py:attribute:: _parameters .. py:method:: __repr__() .. py:class:: Tag(name) Bases: :py:obj:`DB` .. py:attribute:: id .. py:attribute:: name .. py:method:: __repr__() .. py:data:: resource_tags .. py:function:: _validate_webhook(value) .. py:function:: _validate_email(value) .. py:class:: Recipient(channel, location) Bases: :py:obj:`DB` Notification recipient .. py:attribute:: TYPE_EMAIL :value: 'email' .. py:attribute:: TYPE_WEBHOOK :value: 'webhook' .. py:attribute:: TYPES :value: () .. py:attribute:: __tablename__ :value: 'recipient' .. py:attribute:: VALIDATORS .. py:attribute:: id .. py:attribute:: channel .. py:attribute:: location .. py:attribute:: resources .. py:method:: validate(channel, value) :classmethod: Validate if provided value is correct for given channel .. py:method:: is_email() .. py:method:: is_webhook() .. py:method:: burry_dead() :classmethod: .. py:method:: get_or_create(channel, location) :classmethod: .. py:method:: get_suggestions(channel, for_user) :classmethod: Return list of values to autocomplete for specific user and channel. .. py:class:: ResourceNotification Bases: :py:obj:`DB` m2m for Recipient <-> Resource .. py:attribute:: __tablename__ :value: 'resourcenotification' .. py:attribute:: resource_id .. py:attribute:: recipient_id .. py:attribute:: resource .. py:attribute:: recipient .. py:class:: Resource(owner, resource_type, title, url, tags, auth=None) Bases: :py:obj:`DB` HTTP accessible resource .. py:property:: run_count .. py:property:: get_capabilities_url .. py:property:: all_response_times .. py:property:: first_run .. py:property:: last_run .. py:property:: average_response_time .. py:property:: min_response_time .. py:property:: max_response_time .. py:property:: reliability .. py:property:: tags2csv .. py:property:: auth .. py:property:: auth_type .. py:attribute:: identifier .. py:attribute:: resource_type .. py:attribute:: active .. py:attribute:: title .. py:attribute:: url .. py:attribute:: latitude .. py:attribute:: longitude .. py:attribute:: owner_identifier .. py:attribute:: owner .. py:attribute:: tags .. py:attribute:: run_frequency .. py:attribute:: _auth .. py:method:: __repr__() .. py:method:: snippet() .. py:method:: runs_to_json() .. py:method:: success_to_colors() .. py:method:: clear_recipients(channel=None, burry_dead=True) .. py:method:: get_recipients(channel) .. py:method:: set_recipients(channel, items) .. py:method:: dump_recipients() Return dictionary with channel ->recipients mapping .. py:method:: has_auth() .. py:method:: add_auth_header(headers_dict) .. py:method:: for_json() .. py:class:: ResourceLock(resource, owner, interval_mins) Bases: :py:obj:`DB` lock resource for multiprocessing runs .. py:attribute:: identifier .. py:attribute:: resource_identifier .. py:attribute:: resource .. py:attribute:: owner .. py:attribute:: start_time .. py:attribute:: end_time .. py:method:: init_datetimes(interval_mins) .. py:method:: has_expired() .. py:method:: obtain(owner, frequency) .. py:method:: __repr__() .. py:class:: User(username, password, email, role='user') Bases: :py:obj:`DB` user accounts. Token handling thanks to: https://navaspot.wordpress.com/2014/06/25/ how-to-implement-forgot-password-feature-in-flask/ .. py:attribute:: identifier .. py:attribute:: username .. py:attribute:: password .. py:attribute:: email .. py:attribute:: role .. py:attribute:: registered_on .. py:method:: authenticate(password) .. py:method:: encrypt(string) .. py:method:: get_token(expiration=7200) .. py:method:: is_authenticated() .. py:method:: is_active() .. py:method:: is_anonymous() .. py:method:: get_id() .. py:method:: set_password(password) .. py:method:: verify_token(token) :staticmethod: .. py:method:: __repr__() .. py:function:: get_resource_types_counts() return frequency counts and totals of registered resource types .. py:function:: get_resources_count() return number of rows for Resource .. py:function:: get_runs_count() return number of rows for Run .. py:function:: get_runs_status_count(success=True) return number of rows for Run with given run status .. py:function:: get_first_run() return last Run .. py:function:: get_last_run() return last Run .. py:function:: get_last_run_per_resource() return last N Runs with results for each Resource .. py:function:: get_tag_counts() return counts of all tags .. py:function:: load_data(file_path) .. py:function:: db_commit() .. py:data:: APP