Copper

Overview

Copper is a customer relationship management (CRM) platform to track individuals, companies and activity data. This Parsons class provides methods for extracting people, companies and actions.

Note

Getting Your API Key
  • Sign into Copper
  • Click on Settings (gear icon) and then API Keys
  • Click the GENERATE API KEY button

Quickstart

To instantiate the Copper class, you can either store the Copper user email and API key as environmental variables (COPPER_USER_EMAIL, COPPER_API_KEY) or pass them in as arguments:

from parsons import Copper

# First approach: Use API key and user email via environmental variables
copper = Copper()

# Second approach: Pass API credentials and user email as arguments
copper = Copper(user_email='me@myorg.com', api_key='MYAPIKEY')

You can then call various endpoints:

# Get people

# This will unpack the people json as a dict of Parsons Tables.
people_tbls = copper.get_people()

# You can then save the tables as csvs
for k, v in people_tbls.items():
        v.to_csv(f'{k}_copper.csv')

# Or you send the tables to a database
pg = Postgres()
for k, v in people_tbls.items():
        v.to_postgres(f'copper.{k}', if_exists='drop')

# Get companies

# Get companies modified since a date, unix time. This will unpack the companies
json as a dict of Parsons Tables.
company_tbls = copper.get_companies({'minimum_modified_date': 1599674523})

API

class parsons.Copper(user_email=None, api_key=None)[source]

Instantiate Copper Class

Args:
user_email:
The email of the API user for Copper. Not required if COPPER_USER_EMAIL env variable set.
api_key:
The Copper provided application key. Not required if COPPER_API_KEY env. variable set.
Returns:
Copper Class
get_people(filters=None, tidy=False)[source]

Get people

Args:
filters: dict
Optional; pass additional parameters to filter the records returned. See Copper documentation for choices
tidy: boolean or int
Optional; unpack list and dict columns as additional rows instead of columns If True: creates new table out of unpacked rows If ‘int’: adds rows to original table if max rows per key <= given number (so tidy=0 guarantees new table)
Returns:
List of dicts of Parsons Tables:
  • people
  • people_emails
  • people_phone_numbers
  • people_custom_fields
  • people_socials
  • people_websites
get_companies(filters=None, tidy=False)[source]

Get companies

Args:
filters: dict
Optional; pass additional parameters to filter the records returned. See Copper documentation for choices
tidy: boolean or int
Optional; unpack list and dict columns as additional rows instead of columns If True: creates new table out of unpacked rows If ‘int’: adds rows to original table if max rows per key <= given number (so tidy=0 guarantees new table)
Returns:
List of dicts of Parsons Tables:
  • companies
  • companies_phone_numbers
  • companies_custom_fields
  • companies_socials
  • companies_websites
get_activities(filters=None, tidy=False)[source]

Get activities

Args:
filters: dict
Optional; pass additional parameters to filter the records returned. See Copper documentation for choices Optional; unpack list and dict columns as additional rows instead of columns If True: creates new table out of unpacked rows If ‘int’: adds rows to original table if max rows per key <= given number (so tidy=0 guarantees new table)
Returns:
List of dicts of Parsons Tables:
  • activities
get_opportunities(filters=None, tidy=False)[source]

Get opportunities (i.e. donations)

Args:
filters: dict
Optional; pass additional parameters to filter the records returned. See Copper documentation for choices Optional; unpack list and dict columns as additional rows instead of columns If True: creates new table out of unpacked rows If ‘int’: adds rows to original table if max rows per key <= given number (so tidy=0 guarantees new table)
Returns:
List of dicts of Parsons Tables:
  • opportunities
  • opportunities_custom_fields
get_custom_fields()[source]

Get custom fields

Args:
filters: dict Optional; pass additional parameters to filter the records returned. See Copper documentation for choices
Returns:
List of dicts of Parsons Tables:
  • custom_fields
  • custom_fields_available
  • custom_fields_options
get_activity_types()[source]

Get activity types

Args:
filters: dict Optional; pass additional parameters to filter the records returned. See Copper documentation for choices
Returns:
List of dicts of Parsons Tables:
  • activitiy_types
get_contact_types()[source]

Get contact types

Args:
filters: dict Optional; pass additional parameters to filter the records returned. See Copper documentation for choices
Returns:
Parsons Table
See Parsons Table for output options.