New/Mode
New/Mode is the multi-channel advocacy & civic engagement platform for organizations and campaigns.
Most methods and functions in Parsons return a Table
, which is a 2D list-like object. Read
more in Table documentation.
Quick Start
from parsons import Newmode
newmode = Newmode(api_user='XXXX', api_password='XXXX')
# Get existing tools.
tools = newmode.get_tools()
# Get specific tool.
tool = newmode.get_tool(tool_id)
API
- class parsons.Newmode(api_user=None, api_password=None, api_version=None)[source]
- get_tools(params={})[source]
Get existing tools. Args:
- params:
Extra parameters sent to New/Mode library.
- Returns:
Tools information as table.
- get_tool(tool_id, params={})[source]
Get specific tool. Args:
- tool_id:
The id of the tool to return.
- params:
Extra parameters sent to New/Mode library.
- Returns:
Tool information.
- lookup_targets(tool_id, search=None, params={})[source]
Lookup targets for a given tool Args:
- tool_id:
The tool to lookup targets.
- search:
The search criteria. It could be: - Empty: If empty, return custom targets associated to the tool. - Postal code: Return targets matched by postal code. - Lat/Long: Latitude and Longitude pair separated by ‘::’. Ex. 45.451596::-73.59912099999997. It will return targets matched for those coordinates. - Search term: For your csv tools, this will return targets matched by given valid search term.
- Returns:
Targets information as table.
- get_action(tool_id, params={})[source]
Get the action information for a given tool. Args:
- tool_id:
The id of the tool to return.
- params:
Extra parameters sent to New/Mode library.
- Returns:
Tool action information.
- run_action(tool_id, payload, params={})[source]
Run specific action with given payload. Args:
- tool_id:
The id of the tool to run.
- payload:
Payload data used to run the action. Structure will depend on the stuff returned by get_action.
- params:
Extra parameters sent to New/Mode library.
- Returns:
Action link (if otl) or sid.
- get_target(target_id, params={})[source]
Get specific target. Args:
- target_id:
The id of the target to return.
- params:
Extra parameters sent to New/Mode library.
- Returns:
Target information.
- get_campaigns(params={})[source]
Get existing campaigns. Args:
- params:
Extra parameters sent to New/Mode library.
- Returns:
Campaigns information as table.
- get_campaign(campaign_id, params={})[source]
Get specific campaign. Args:
- campaign_id:
The id of the campaign to return.
- params:
Extra parameters sent to New/Mode library.
- Returns:
Campaign information.
- get_organizations(params={})[source]
Get existing organizations. Args:
- params:
Extra parameters sent to New/Mode library.
- Returns:
Organizations information as table.
- get_organization(organization_id, params={})[source]
Get specific organization. Args:
- organization_id:
The id of the organization to return.
- params:
Extra parameters sent to New/Mode library.
- Returns:
Organization information.
- get_services(params={})[source]
Get existing services. Args:
- params:
Extra parameters sent to New/Mode library.
- Returns:
Services information as table.
- get_service(service_id, params={})[source]
Get specific service. Args:
- service_id:
The id of the service to return.
- params:
Extra parameters sent to New/Mode library.
- Returns:
Service information.