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 thenAPI KeysClick the
GENERATE API KEYbutton
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.copper.Copper(user_email=None, api_key=None)[source]¶
Instantiate Copper Class
- Parameters:
user_email – The email of the API user for Copper. Not required if
COPPER_USER_EMAILenv variable set.api_key – The Copper provided application key. Not required if
COPPER_API_KEYenv. variable set.
- Returns:
Copper Class
- get_people(filters=None, tidy=False)[source]¶
Get people
- Parameters:
`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:
people
people_emails
people_phone_numbers
people_custom_fields
people_socials
people_websites
- Return type:
List of dicts of Parsons Tables
- get_companies(filters=None, tidy=False)[source]¶
Get companies
- Parameters:
`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:
companies
companies_phone_numbers
companies_custom_fields
companies_socials
companies_websites
- Return type:
List of dicts of Parsons Tables
- get_activities(filters=None, tidy=False)[source]¶
Get activities
- Parameters:
`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:
activities
- Return type:
List of dicts of Parsons Tables
- get_opportunities(filters=None, tidy=False)[source]¶
Get opportunities (i.e. donations)
- Parameters:
`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:
opportunities
opportunities_custom_fields
- Return type:
List of dicts of Parsons Tables
- get_custom_fields()[source]¶
Get custom fields
- Parameters:
`filters –
dict`
returned. (Optional; pass additional parameters to filter the records)
choices (See Copper documentation for)
- Returns:
custom_fields
custom_fields_available
custom_fields_options
- Return type:
List of dicts of Parsons Tables
- get_activity_types()[source]¶
Get activity types
- Parameters:
`filters –
dict`
returned. (Optional; pass additional parameters to filter the records)
choices (See Copper documentation for)
- Returns:
activitiy_types
- Return type:
List of dicts of Parsons Tables
- get_contact_types()[source]¶
Get contact types
- Parameters:
`filters –
dict`
returned. (Optional; pass additional parameters to filter the records)
choices (See Copper documentation for)
- Returns:
- Parsons Table
See Parsons Table for output options.