API¶
pdf12step.cli¶
pdf12step.client¶
- class pdf12step.client.Client(site_url, api_url, nonce_url=None, api_key=None)[source]¶
Bases:
objectClient that makes HTTP[S] calls to the WP site and fetches the data
- Parameters
url (str) – Base URL of the WP site to gather data from
- api_url = None¶
- download(sections=None, format='json', data_dir='/home/docs/checkouts/readthedocs.org/user_builds/pdf12step/checkouts/latest/docs/data', prefix=None)[source]¶
Downloads all the TSML endpoints meeting data to the DATA_DIR destination.
- Parameters
sections (tuple) – Specific sections to download (eg meetings)
format (str) – Which format to load the data in (eg json/csv)
- meetings(**params)[source]¶
Returns meeting data with the given query params
- Parameters
params (dict) – Query parameters to use in GET request
- Return type
list
- property nonce¶
Fetches the nonce on a base page to use in subsequent requests to the WP site Bypasses WP CSRF protection
- Return type
str
- nonce_url = None¶
- sections = ('meetings',)¶
pdf12step.config¶
pdf12step.flask_app¶
pdf12step.meetings¶
- class pdf12step.meetings.Meeting(arg=(), **kwargs)[source]¶
Bases:
pdf12step.adict.AttrDict- property address_display¶
Displays a long form address line
- property attendance_option¶
- property conference_id¶
Returns the conference ID from the URL usually used for zoom
- property conference_id_formatted¶
Returns a formatted conference ID. Eg 000 000 0000 for zoom
- property conference_notes_display¶
Gets the text of the conference notes
- property conference_type¶
Returns the type of conference URL by domain name (zoom/gotomeet/google) Returns domain if nothing matches
- property conference_url¶
Returns a cleaned conference_url
- property day_display¶
Gets the weekday name (eg Thursday)
- property id_display¶
Gets a unique ID of the meeting either from the id or slug field or python generated
- property is_conference¶
Returns True if the attendance_option is either online or hybrid. Failing having that value, determines whether a conference_url is set
- property latlon¶
Returns the latitude,longitude tuple for usage in map locations
- property notes_list¶
Returns a list of notes
- property region_display¶
Gets the text of the region and sub_region
- property time_display¶
Returns the formatted time of day in H:M AM/PM
- property zipcode¶
Returns a 5 digit zipcode from the formatted address
- class pdf12step.meetings.MeetingSet(fn_or_obj)[source]¶
Bases:
object- property by_id¶
Returns a dictionary mapping between the Meeting’s ID and the Meeting object itself
- by_value(attr, sort=False, limit=None, cast=<class 'str'>, reverse=False)[source]¶
Groups the results by the given attribute values. Returns a dict with the values as keys and filtered MeetingSet as values If sorted, it returns a sorted items list If limited, only returns up to X number of Meetings
- property index¶
Returns sorted list of meeting index section information Used to show which meetings meet in which zipcode and on which days
- property items¶
- limit(num)[source]¶
Limits the MeetingSet to num entries
- Parameters
num (int) – Limit number
- Return type
- property names¶
Returns a value_set of names
- property regions¶
Returns a sorted list of regions and the zipcodes associated with them
- sort(*attrs, reverse=False)[source]¶
Returns a new MeetingSet isinstance with the items ordered by the given attributes
- property types¶
Returns a value_set of types
- value_set(attr, sort=False, filter_none=False)[source]¶
Returns a set of unique values for the passed atribute name
- Parameters
attr (str) – Attribute name of a Meeting
- Return type
set
- property zipcodes¶
Returns a set of all zipcodes for meetings in the MeetingSet
pdf12step.templating¶
- class pdf12step.templating.Context(config, args)[source]¶
Bases:
dictContext for jinja2 templating
- Parameters
args (dict) – Runtime arguments to inject into template context
- property env¶
Returns jinja2 Environment used to render all templates.
- Return type
jinja2.Environment
- property filtered_codes¶
Returns a list of meeting (code, name) after the codes have been filtered and remapped
- Return type
list
- get_meetings(meetings_file=None)[source]¶
Loads list of meetings for main context based on filters/limiting
- Return type
- html(template=None)[source]¶
Gets the weasyprint HTML instance from this ontext
- Return type
weasyprint.HTML
- prerender()[source]¶
Prerenders the assets ahead of page render to ensure proper values in assets are set
- property qrcode¶
- render(template=None)[source]¶
Renders a template by name and returns its content
- Parameters
template (str) – relative name of template to load
- Return type
str
- property stylesheets¶
Returns a list of CSS stylesheets to include. Adds default stylesheet assets/css/style.css first and adds others from config.stylesheets
- Return type
list
- property template_dirs¶
Returns a list of template directories for jinja2 to search Adds default stylesheet pdf12step/templates first and adds others from config.stylesheets
- Return type
list
- property zipcodes_by_region¶
Returns a mapping of region->zipcode for zipcode list in config
- Return type
dict