Mobilize America

Overview

Mobilize America is an activist signup tool used by progressive organizations. This class provides several methods for fetching organizations, people, and events from their API, which is currently in alpha development.

Note

Authentication
Some methods in the MobilizeAmerica class require an API Key furnished by Mobilize America (private methods), while others do not (public methods). Each method in this class contains a note indicating whether it is public or private. For more information, see the API documentation.

Quickstart

If you instantiate MobilizeAmerica without an API Key, you can only use public methods:

In order to use private methods, you must provide an API key either by setting the environmental variable MOBILIZE_AMERICA_API_KEY or by passing an api_key argument as shown below:

API

class parsons.MobilizeAmerica(api_key=None)[source]

Instantiate MobilizeAmerica Class

api_key: str
An api key issued by Mobilize America. This is required to access some private methods.
Returns:
MobilizeAmerica Class
get_organizations(updated_since=None)[source]

Return all active organizations on the platform.

Args:
updated_since: str
Filter to organizations updated since given date (ISO Date)
Returns
Parsons Table
See Parsons Table for output options.
get_events(organization_id=None, updated_since=None, timeslot_start=None, timeslot_end=None, timeslots_table=False, max_timeslots=None)[source]

Fetch all public events on the platform.

Args:
organization_id: list or int
Filter events by a single or multiple organization ids
updated_since: str
Filter to events updated since given date (ISO Date)
timeslot_start: str
Filter by a timeslot start of events using >,``>=``,``<,``<= operators and ISO date (ex. <=2018-12-13 05:00:00PM)
timeslot_end: str
Filter by a timeslot end of events using >,``>=``,``<,``<= operators and ISO date (ex. <=2018-12-13 05:00:00PM)
timeslot_table: boolean
Return timeslots as a separate long table. Useful for extracting to databases.
max_timeslots: int

If not returning a timeslot table, will unpack time slots. If do not set this kwarg, it will add a column for each time slot. The argument limits the number of columns and discards any additional timeslots after that.

For example: If there are 20 timeslots associated with your event, and you set the max time slots to 5, it will only return the first 5 time slots as time_slot_0, time_slot_1 etc.

This is helpful in situations where you have a regular sync running and want to ensure that the column headers remain static.

Returns
Parsons Table or dict or Parsons Tables
See Parsons Table for output options.
get_events_organization(organization_id=None, updated_since=None, timeslot_start=None, timeslot_end=None, timeslots_table=False, max_timeslots=None)[source]

Fetch all public events for an organization. This includes both events owned by the organization (as indicated by the organization field on the event object) and events of other organizations promoted by this specified organization.

Note

API Key Required

Args:
organization_id: list or int
Filter events by a single or multiple organization ids
updated_since: str
Filter to events updated since given date (ISO Date)
timeslot_start: str
Filter by a timeslot start of events using >,``>=``,``<,``<= operators and ISO date (ex. <=2018-12-13 05:00:00PM)
timeslot_end: str
Filter by a timeslot end of events using >,``>=``,``<,``<= operators and ISO date (ex. <=2018-12-13 05:00:00PM)
timeslot_table: boolean
Return timeslots as a separate long table. Useful for extracting to databases.
zipcode: str
Filter by a Events’ Locations’ postal code. If present, returns Events sorted by distance from zipcode. If present, virtual events will not be returned.
max_dist: str
Filter Events’ Locations’ distance from provided zipcode.
visibility: str
Either PUBLIC or PRIVATE. Private events only return if user is authenticated; if visibility=PRIVATE and user doesn’t have permission, no events returned.
exclude_full: bool
If exclude_full=true, filter out full Timeslots (and Events if all of an Event’s Timeslots are full)
is_virtual: bool
is_virtual=false will return only in-person events, while is_virtual=true will return only virtual events. If excluded, return virtual and in-person events. Note that providing a zipcode also implies is_virtual=false.
event_types:enum
The type of the event, one of: CANVASS, PHONE_BANK, TEXT_BANK, MEETING, COMMUNITY, FUNDRAISER, MEET_GREET, HOUSE_PARTY, VOTER_REG, TRAINING, FRIEND_TO_FRIEND_OUTREACH, DEBATE_WATCH_PARTY, ADVOCACY_CALL, OTHER. This list may expand in the future.
max_timeslots: int

If not returning a timeslot table, will unpack time slots. If do not set this arg, it will add a column for each time slot. The argument limits the number of columns and discards any additional timeslots after that.

For example: If there are 20 timeslots associated with your event, and you set the max time slots to 5, it will only return the first 5 time slots as time_slot_0, time_slot_1 etc.

This is helpful in situations where you have a regular sync running and want to ensure that the column headers remain static.

Returns
Parsons Table or dict or Parsons Tables
See Parsons Table for output options.
get_events_deleted(organization_id=None, updated_since=None)[source]

Fetch deleted public events on the platform.

Args:
organization_id: list or int
Filter events by a single or multiple organization ids
updated_since: str
Filter to events updated since given date (ISO Date)
Returns
Parsons Table
See Parsons Table for output options.
get_people(organization_id=None, updated_since=None)[source]

Fetch all people (volunteers) who are affiliated with the organization.

Note

API Key Required

Args:
organization_id: list of int
Filter events by a single or multiple organization ids
updated_since: str
Filter to events updated since given date (ISO Date)
Returns
Parsons Table
See Parsons Table for output options.
get_attendances(organization_id=None, updated_since=None)[source]

Fetch all attendances which were either promoted by the organization or were for events owned by the organization.

Note

API Key Required

Args:
organization_id: list of int
Filter events by a single or multiple organization ids
updated_since: str
Filter to events updated since given date (ISO Date)
Returns
Parsons Table
See Parsons Table for output options.