meetup2xibo.updater package¶
Submodules¶
meetup2xibo.updater.anti_flapper module¶
Avoids flapping Xibo events.
-
class
meetup2xibo.updater.anti_flapper.AntiFlapper(recent_limit, current_limit, future_limit)[source]¶ Bases:
objectAvoids flapping caused when Xibo events do not match Meetup events.
Meetup sometimes fails to retrieve current and recent events that should still be displayed. Meetup often fails to retrieve far future events previously seen because newer events have been added with earlier meeting times. Configuration specifies flapping windows around the current time and in the far future. Missing meetup events will not be deleted from Xibo when they fall within the flapping windows.
-
categorize(xibo_event)[source]¶ Categorize an event based on its times and the flapping window. Return an event flapping status.
-
is_future(xibo_event)[source]¶ Return true if the event ends after the future limit; false otherwise.
-
meetup2xibo.updater.application_scope module¶
Application scope holds command line arguments and environment variables needed by the application.
-
class
meetup2xibo.updater.application_scope.ApplicationScope(args, env_vars)[source]¶ Bases:
objectApplication scope provides configuration values.
-
app_name¶
-
conflict_places¶
-
conflicts¶
-
containing_places¶
-
debug¶
-
default_location¶
-
default_places¶
-
delete_after_end_seconds¶
-
delete_before_start_seconds¶
-
delete_until_future_seconds¶
-
end_time_column_name¶
-
event_dataset_code¶
-
ignore_cancelled_after_seconds¶
-
location_column_name¶
-
log_level¶
-
logfile¶
-
mappings¶
-
meetup_events_wanted¶
-
meetup_group_url_name¶
-
meetup_id_column_name¶
-
more_place_phrase_tuples¶
-
more_place_phrases¶
-
name_column_name¶
-
place_phrase_tuples¶
-
place_phrases¶
-
site_ca_path¶
-
site_url¶
-
special_locations¶
-
special_locations_dict¶
-
start_time_column_name¶
-
suppressed_event_ids¶
-
timezone¶
-
verbose¶
-
version¶
-
warnings¶
-
xibo_client_id¶
-
xibo_client_secret¶
-
xibo_host¶
-
xibo_id_column_name¶
-
xibo_page_length¶
-
xibo_port¶
-
meetup2xibo.updater.command_line module¶
Command line options.
meetup2xibo.updater.event_converter module¶
Converts individual and lists of Meetup events from JSON dictionaries into event objects.
-
class
meetup2xibo.updater.event_converter.Event(meetup_id, name, location, start_time, end_time, places)¶ Bases:
tuple-
end_time¶ Alias for field number 4
-
location¶ Alias for field number 2
-
meetup_id¶ Alias for field number 0
-
name¶ Alias for field number 1
-
places¶ Alias for field number 5
-
start_time¶ Alias for field number 3
-
-
class
meetup2xibo.updater.event_converter.EventConverter(location_chooser, date_time_creator)[source]¶ Bases:
objectConverts Meetup events from JSON dictionaries into event objects.
-
static
event(partial_event, location)[source]¶ Return an event combining a partial event and a location.
-
logger= <Logger EventConverter (WARNING)>¶
-
static
-
class
meetup2xibo.updater.event_converter.EventListConverter(event_converter, event_suppressor)[source]¶ Bases:
objectConverts a list of Meetup events from JSON dictionaries into event objects.
-
class
meetup2xibo.updater.event_converter.PartialEvent(meetup_id, name, start_time, end_time, venue_name, find_us)¶ Bases:
tuple-
end_time¶ Alias for field number 3
-
find_us¶ Alias for field number 5
-
meetup_id¶ Alias for field number 0
-
name¶ Alias for field number 1
-
start_time¶ Alias for field number 2
-
venue_name¶ Alias for field number 4
-
meetup2xibo.updater.event_updater module¶
Updates the events in the Xibo database to conform to events from Meetup.com.
-
class
meetup2xibo.updater.event_updater.EventUpdater(meetup_events, cancelled_meetup_events, xibo_events, xibo_event_crud, anti_flapper, event_suppressor, special_location_monitor)[source]¶ Bases:
objectUpdates events in a Xibo dataset by inserting, updating, or deleting events to make the Xibo events conform to Meetup.com events.
-
delete_unknown_events(event_ids)[source]¶ Delete unknown (to Meetup) events given a set of event IDs.
-
delete_xibo_event(xibo_event, action)[source]¶ Delete an event from Xibo, logging an action such as “Retired”.
-
logger= <Logger EventUpdater (WARNING)>¶
-
update_cancelled_events(event_ids)[source]¶ Update changed events given a set of cancelled event IDs.
-
meetup2xibo.updater.exceptions module¶
Descriptive exceptions.
-
exception
meetup2xibo.updater.exceptions.ContainmentLoopError[source]¶ Bases:
ExceptionRaised when conflict analysis finds a loop in place containment.
-
exception
meetup2xibo.updater.exceptions.DatasetDiscoveryError[source]¶ Bases:
ExceptionRaised when dataset discovery fails.
meetup2xibo.updater.http_response_error module¶
Excepctions that raise when responses contain HTTP errors.
-
exception
meetup2xibo.updater.http_response_error.HttpResponseError[source]¶ Bases:
ExceptionRaised when HTTP response status is not ok.
-
classmethod
check_response_status(response)[source]¶ Raise this exception if the response status is not ok.
-
logger= <Logger HttpResponseError (WARNING)>¶
-
classmethod
-
exception
meetup2xibo.updater.http_response_error.MeetupApiError[source]¶ Bases:
meetup2xibo.updater.http_response_error.HttpResponseErrorRaised when a Meetup HTTP response status is not ok.
-
logger= <Logger MeetupApiError (WARNING)>¶
-
-
exception
meetup2xibo.updater.http_response_error.XiboApiError[source]¶ Bases:
meetup2xibo.updater.http_response_error.HttpResponseErrorRaised when a Xibo HTTP response status is not ok.
-
logger= <Logger XiboApiError (WARNING)>¶
-
meetup2xibo.updater.injector module¶
Test generating the Xibo API.
-
meetup2xibo.updater.injector.inject_anti_flapper(application_scope)[source]¶ Return an anti-flapper configured by an application scope.
-
meetup2xibo.updater.injector.inject_cancelled_last_time(application_scope)[source]¶ Return the last time allowed for cancelled Meetup events configured by an application scope.
-
meetup2xibo.updater.injector.inject_cert_validation_url(application_scope)[source]¶ Return the URL for certificate validation configured by an application scope.
-
meetup2xibo.updater.injector.inject_column_name_manager(application_scope)[source]¶ Return a Xibo column name manager configured by an application scope.
-
meetup2xibo.updater.injector.inject_conflict_analyzer(application_scope)[source]¶ Return a conflict analyzer configured by an application scope.
-
meetup2xibo.updater.injector.inject_conflict_places(application_scope)[source]¶ Return conflict places configured by an application scope.
-
meetup2xibo.updater.injector.inject_current_limit(application_scope)[source]¶ Return the current flapping limit configured by an application scope.
-
meetup2xibo.updater.injector.inject_date_time_creator(application_scope)[source]¶ Return a date/time creator configured by an application scope.
-
meetup2xibo.updater.injector.inject_default_event_location(application_scope)[source]¶ Return an event location for the default location and places configured by an application scope.
-
meetup2xibo.updater.injector.inject_enter_logging_application_scope(application_scope)[source]¶ Return a function configured by an application scope that provides a processor configured by an application scope and a notional logging application scope.
-
meetup2xibo.updater.injector.inject_enter_xibo_event_crud_scope(application_scope, xibo_session_scope)[source]¶ Return a function configured by an application scope that provides a Xibo event CRUD processor configured by an application scope and a Xibo session scope.
-
meetup2xibo.updater.injector.inject_enter_xibo_session_scope(application_scope)[source]¶ Return a function configured by an application scope that provides a Xibo session processor configured by an application scope and a Xibo session scope.
-
meetup2xibo.updater.injector.inject_event_converter(application_scope)[source]¶ Return an event converter configured by an application scope.
-
meetup2xibo.updater.injector.inject_event_list_converter(application_scope)[source]¶ Return an event list converter configured by an application scope.
-
meetup2xibo.updater.injector.inject_event_suppressor(application_scope)[source]¶ Return an event suppressor configured by an application scope.
-
meetup2xibo.updater.injector.inject_event_suppressor_provider(application_scope)[source]¶ Return a function that provides an event suppressor configured by an application session scope.
-
meetup2xibo.updater.injector.inject_event_updater_provider(application_scope, xibo_session_scope)[source]¶ Return a function that provides an event updater configured by a Xibo session scope.
-
meetup2xibo.updater.injector.inject_future_limit(application_scope)[source]¶ Return the future flapping limit configured by an application scope.
-
meetup2xibo.updater.injector.inject_location_chooser(application_scope)[source]¶ Return a location builder configured by an application scope.
-
meetup2xibo.updater.injector.inject_logging_application(application_scope)[source]¶ Return a logging application configured by an application scope.
-
meetup2xibo.updater.injector.inject_logging_context(application_scope)[source]¶ Return a logging context configured by an application scope.
-
meetup2xibo.updater.injector.inject_logging_setup_manager(application_scope)[source]¶ Return a logging setup manager configured by an application scope.
-
meetup2xibo.updater.injector.inject_meetup2xibo(application_scope)[source]¶ Return a Meetup to Xibo converter configured by an application scope.
-
meetup2xibo.updater.injector.inject_meetup_events_retriever(application_scope)[source]¶ Return a Meetup events retriever configured by an application scope.
-
meetup2xibo.updater.injector.inject_more_places_phrase_mapper(application_scope)[source]¶ Return a phrase mapper for more place phrases configured by an application scope.
-
meetup2xibo.updater.injector.inject_no_trace_exceptions()[source]¶ Return a tuple listing exception classes that need no traceback.
-
meetup2xibo.updater.injector.inject_null_conflict_analyzer()[source]¶ Return a null conflict analyzer.
-
meetup2xibo.updater.injector.inject_oauth2_session_starter(application_scope)[source]¶ Return an Oauth2SessionStarter configured by an application scope.
-
meetup2xibo.updater.injector.inject_phrase_mapper(application_scope, phrase_tuples)[source]¶ Return a phrase mapper configured by an application scope and a list of tuples containing a phrase and its preferred phrase.
-
meetup2xibo.updater.injector.inject_phrase_mappers(application_scope)[source]¶ Return a list of phrase mappers configured by an application scope.
-
meetup2xibo.updater.injector.inject_place_finder(application_scope)[source]¶ Return a place finder configured by an application scope.
-
meetup2xibo.updater.injector.inject_places_phrase_mapper(application_scope)[source]¶ Return a phrase mapper for place phrases configured by an application scope.
-
meetup2xibo.updater.injector.inject_recent_limit(application_scope)[source]¶ Return the recent flapping limit configured by an application scope.
-
meetup2xibo.updater.injector.inject_selected_conflict_analyzer(application_scope)[source]¶ Return the conflict analyzer selected by a command-line argument and configured by an application scope.
-
meetup2xibo.updater.injector.inject_site_cert_assurer(application_scope)[source]¶ Return a site certificate assurer configured by an application scope.
-
meetup2xibo.updater.injector.inject_special_location_monitor(application_scope)[source]¶ Return a special location monitor configured by an application scope.
-
meetup2xibo.updater.injector.inject_tzinfo(application_scope)[source]¶ Return timezone info configured by an application scope.
-
meetup2xibo.updater.injector.inject_user_agent(application_scope)[source]¶ Return the user agent string for web requests configured by an application scope.
-
meetup2xibo.updater.injector.inject_xibo_api(application_scope, xibo_session_scope)[source]¶ Return a Xibo API manager configured by an application scope and a Xibo session scope.
-
meetup2xibo.updater.injector.inject_xibo_api_url_builder(application_scope)[source]¶ Return a Xibo API URL builder configured by an application scope.
-
meetup2xibo.updater.injector.inject_xibo_column_names(application_scope)[source]¶ Return Xibo event column names configured by an application scope.
-
meetup2xibo.updater.injector.inject_xibo_dataset_id_finder(application_scope, xibo_session_scope)[source]¶ Return a Xibo dataset ID finder configured by an application scope and a Xibo session scope.
-
meetup2xibo.updater.injector.inject_xibo_event_column_id_manager(xibo_event_crud_scope)[source]¶ Return a Xibo column ID manager configured by a Xibo event CRUD scope.
-
meetup2xibo.updater.injector.inject_xibo_event_crud(application_scope, xibo_session_scope, xibo_event_crud_scope)[source]¶ Return a Xibo event CRUD manager configured by an application scope, a Xibo session scope and a Xibo event CRUD scope.
-
meetup2xibo.updater.injector.inject_xibo_event_crud_processor(application_scope, xibo_session_scope, xibo_event_crud_scope)[source]¶ Return Xibo event CRUD processor configured by an application scope, a Xibo session scope and a Xibo event CRUD scope.
meetup2xibo.updater.location_chooser module¶
Chooses locations for partial events.
-
class
meetup2xibo.updater.location_chooser.LocationChooser(place_finder, special_locations, default_event_location)[source]¶ Bases:
objectChooses locations for partial events.
For events with no special location, prefer any computed location over the default.
For events with a special location and no computed location, prefer any special location over the default.
For events with both an special location and a computed location, if the override flag is set, prefer any special location over any computed location over the default; otherwise prefer the computed location over the special location over the default.
-
logger= <Logger LocationChooser (WARNING)>¶
-
resolve_locations(partial_event, computed_event_location, special_location)[source]¶ Choose an appropriate event location based on the availability of a special location.
-
meetup2xibo.updater.logging_context module¶
Provide a logging context to open and close loggers and handle otherwise unhandled exceptions.
-
class
meetup2xibo.updater.logging_context.LoggingContext(app_name, description, logging_setup_manager, no_trace_exceptions)[source]¶ Bases:
objectLogging context configures logging and reports exit exceptions.
meetup2xibo.updater.meetup2xibo module¶
Retrieve events from Meetup, extract data to display on signs, and update Xibo.
-
class
meetup2xibo.updater.meetup2xibo.Meetup2Xibo(meetup_events_retriever, conflict_analyzer, event_list_converter, site_cert_assurer, oauth2_session_starter, event_suppressor, enter_xibo_session_scope)[source]¶ Bases:
objectDownloads Meetup events into a Xibo database.
-
class
meetup2xibo.updater.meetup2xibo.XiboEventCrudProcessor(xibo_event_crud, provide_event_updater)[source]¶ Bases:
objectUpdates events stored in Xibo to match the Meetup events.
-
class
meetup2xibo.updater.meetup2xibo.XiboEventCrudScope(event_dataset_id, event_column_ids)¶ Bases:
tuple-
event_column_ids¶ Alias for field number 1
-
event_dataset_id¶ Alias for field number 0
-
-
class
meetup2xibo.updater.meetup2xibo.XiboSessionProcessor(event_dataset_code, dataset_id_finder, column_name_manager, xibo_api, enter_xibo_event_crud_scope)[source]¶ Bases:
objectRetreives event dataset metadata from Xibo.
meetup2xibo.updater.meetup_api module¶
Access Meetup API to download events.
meetup2xibo.updater.oauth2_session_starter module¶
Starts an OAuth2 session.
meetup2xibo.updater.phrase_mapper module¶
Map phrases to preferred phrases.
-
class
meetup2xibo.updater.phrase_mapper.PhraseMapper(automaton, phrase_tuples)[source]¶ Bases:
objectRewrites a string, mapping phrases to preferred phrases.
-
logger= <Logger PhraseMapper (WARNING)>¶
-
-
class
meetup2xibo.updater.phrase_mapper.PhraseMapping(preferred_phrase, phrase_length)¶ Bases:
tuple-
phrase_length¶ Alias for field number 1
-
preferred_phrase¶ Alias for field number 0
-
-
class
meetup2xibo.updater.phrase_mapper.SortableMatch(start, descending_phrase_length, end, preferred_phrase)¶ Bases:
tuple-
descending_phrase_length¶ Alias for field number 1
-
end¶ Alias for field number 2
-
preferred_phrase¶ Alias for field number 3
-
start¶ Alias for field number 0
-
-
meetup2xibo.updater.phrase_mapper.is_valid_match(match, text)[source]¶ True unless the match starts or ends in the middle of a word.
-
meetup2xibo.updater.phrase_mapper.longest_non_overlapping_matches(sorted_matches)[source]¶ Return a generator of the longest non-overlapping matches from a sorted list of matches.
meetup2xibo.updater.site_cert_assurer module¶
Assures that Python Requests recognizes a site’s certificate.
-
class
meetup2xibo.updater.site_cert_assurer.SiteCertAssurer(sys_ca_path, site_ca_path, site_url, user_agent)[source]¶ Bases:
objectAssures that Python Requests recognizes a site’s certificate.
-
append_site_cert()[source]¶ Append the site-specific certificate authority file to the Python Requests certificate authority file.
-
logger= <Logger SiteCertAssurer (WARNING)>¶
-
meetup2xibo.updater.special_location_monitor module¶
Monitors special locations and reports when they are not needed.
-
class
meetup2xibo.updater.special_location_monitor.SpecialLocationMonitor(special_locations)[source]¶ Bases:
objectMonitors special locations and reports when they are not needed.
-
deleted_event(xibo_event)[source]¶ Log a warning when a deleted Xibo event has a corresponding special location.
-
logger= <Logger SpecialEventsMonitor (WARNING)>¶
-
meetup2xibo.updater.xibo_api module¶
Access Xibo API to update events.
-
class
meetup2xibo.updater.xibo_api.XiboApi(session, xibo_api_url_builder, page_length)[source]¶ Bases:
objectHides details of accessing the Xibo API.
-
get_dataset_column_by_id(dataset_id)[source]¶ Get a JSON list of dataset column metadata, searching by the dataset id.
-
get_datasets_by_code(dataset_code)[source]¶ Get a JSON list of metadata about a dataset, searching by its code.
-
get_paged_json(url, **payload)[source]¶ Request a URL and return an iterable of all paged JSON results.
-
logger= <Logger Xibo_API_Connection (WARNING)>¶
-
meetup2xibo.updater.xibo_api_url_builder module¶
Builds URLs for the XIBO API.
-
class
meetup2xibo.updater.xibo_api_url_builder.XiboApiUrlBuilder(hostname, port=None)[source]¶ Bases:
objectBuilds URLs for Xibo API methods.
-
dataset_column_url(dataset_id)[source]¶ Return the URL for retrieving column descriptions from the specified dataset.
-
meetup2xibo.updater.xibo_dataset_id_finder module¶
Finds Xibo dataset IDs.
-
class
meetup2xibo.updater.xibo_dataset_id_finder.XiboDatasetIdFinder(xibo_api)[source]¶ Bases:
objectFinds Xibo dataset IDs.
-
datasets_problem(dataset_code, datasets)[source]¶ Return a message describing the problem with the list of datasets for a dataset code.
-
meetup2xibo.updater.xibo_event module¶
Event representations in Xibo.
-
class
meetup2xibo.updater.xibo_event.XiboEvent(meetup_id, name, location, start_time, end_time, xibo_id)¶ Bases:
tuple-
end_time¶ Alias for field number 4
-
location¶ Alias for field number 2
-
meetup_id¶ Alias for field number 0
-
name¶ Alias for field number 1
-
start_time¶ Alias for field number 3
-
xibo_id¶ Alias for field number 5
-
-
class
meetup2xibo.updater.xibo_event.XiboEventColumnIdManager(column_ids)[source]¶ Bases:
objectManages event conversion based on column IDs.
meetup2xibo.updater.xibo_event_crud module¶
Create, read, update, and delete events in Xibo.