cu-api


Namecu-api JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/cooper-richason/cu_api
Summarya fun project
upload_time2024-12-28 02:34:41
maintainerNone
docs_urlNone
authorCooper Richason
requires_python>=3.7
licenseApache Software License 2.0
keywords nbdev jupyter notebook python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CU API

I use [Copper's](https://copper.com/) API a lot for work, so a module of functions to work with in in Python. This is my attempt to turn these functions into a package that can be used by others.


## Installation

If you are already in a Notebook, you can still the package to your environment with python:

``` python
!pip install cu_api
```
This package is designed to be a user friendly wrapper for the Copper
CRM API to make interacting witth and pulling data easier.

Or install the package to your environment in the command line:
## Install

You can install the `cu_api` package through PyPI:

``` {.bash .shell}
pip install cu_api
```

## Queries and Searching

To get most information from the Copper API, you need to search for it. You can define what companies, people, opportunities, etc. you are interested in by specifying various filters. These can be values in Custom Fields that you defined, or standard fields on each record type.

This package makes this easier uses a `Query` object to hold the various filters you would like to use.

Since, I work in Advertising. Let's assume that I would like to pull the information for all Advertisers in the CRM. We can first create a new query:

``` python
from cu_api import Query

Advertisers = Query()
```

Then we can add a filter to search for companies that have the "Live" value in the "Campaign Status" field:

``` python
Advertisers['Campaign Satus'] = 'Live'

## Or, if you know the id of the custom field:

Advertisers[2938821] = 'Live'
```

We can also add other filters to check only get Advertisers in California and from a specific sales person:

``` python
Advertisers['state'] = 'CA'
Advertisers['owner'] = 'Jim Halpert'
```

Your `Advertisers` query can then used with the `search` function to get data from Copper.
## How to use

Start by importing all the modules you’ll need for your project. The
`cuapi_wrapper` package is broken down into seperate modules for working
with companies, tasks, opportunities, users, etc.

For example, if we wanted to look at **companies** in copper, we should
start by importing the **copper_crm.companies** module. We can then
search these companies for those who are in California:

``` python

from cu_api import search

df = search.companies(Advertisers)
```


import cu_api.companies as companies

companies.set_headers(os.environ['MY_COPPER_KEY'],'myemail@email.com')

SunnyStates = companies.Query
SunnyStates['state'] = ['CA','FL','AZ','TX']
SunnyStates['Amenities'] = ['Pool','Beach','Hot tub']
SunnyStates.outputs = ['Account Manager','Lifetime Spend']

companies.search(SunnyStates)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cooper-richason/cu_api",
    "name": "cu-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "nbdev jupyter notebook python",
    "author": "Cooper Richason",
    "author_email": "144618753+cooper-richason@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/5b/b1/bf7ea1ce64a5a04a386b080f82d898a7808f75d385bae6c32b08b93d59a2/cu_api-0.0.2.tar.gz",
    "platform": null,
    "description": "# CU API\n\nI use [Copper's](https://copper.com/) API a lot for work, so a module of functions to work with in in Python. This is my attempt to turn these functions into a package that can be used by others.\n\n\n## Installation\n\nIf you are already in a Notebook, you can still the package to your environment with python:\n\n``` python\n!pip install cu_api\n```\nThis package is designed to be a user friendly wrapper for the Copper\nCRM API to make interacting witth and pulling data easier.\n\nOr install the package to your environment in the command line:\n## Install\n\nYou can install the `cu_api` package through PyPI:\n\n``` {.bash .shell}\npip install cu_api\n```\n\n## Queries and Searching\n\nTo get most information from the Copper API, you need to search for it. You can define what companies, people, opportunities, etc. you are interested in by specifying various filters. These can be values in Custom Fields that you defined, or standard fields on each record type.\n\nThis package makes this easier uses a `Query` object to hold the various filters you would like to use.\n\nSince, I work in Advertising. Let's assume that I would like to pull the information for all Advertisers in the CRM. We can first create a new query:\n\n``` python\nfrom cu_api import Query\n\nAdvertisers = Query()\n```\n\nThen we can add a filter to search for companies that have the \"Live\" value in the \"Campaign Status\" field:\n\n``` python\nAdvertisers['Campaign Satus'] = 'Live'\n\n## Or, if you know the id of the custom field:\n\nAdvertisers[2938821] = 'Live'\n```\n\nWe can also add other filters to check only get Advertisers in California and from a specific sales person:\n\n``` python\nAdvertisers['state'] = 'CA'\nAdvertisers['owner'] = 'Jim Halpert'\n```\n\nYour `Advertisers` query can then used with the `search` function to get data from Copper.\n## How to use\n\nStart by importing all the modules you\u2019ll need for your project. The\n`cuapi_wrapper` package is broken down into seperate modules for working\nwith companies, tasks, opportunities, users, etc.\n\nFor example, if we wanted to look at **companies** in copper, we should\nstart by importing the **copper_crm.companies** module. We can then\nsearch these companies for those who are in California:\n\n``` python\n\nfrom cu_api import search\n\ndf = search.companies(Advertisers)\n```\n\n\nimport cu_api.companies as companies\n\ncompanies.set_headers(os.environ['MY_COPPER_KEY'],'myemail@email.com')\n\nSunnyStates = companies.Query\nSunnyStates['state'] = ['CA','FL','AZ','TX']\nSunnyStates['Amenities'] = ['Pool','Beach','Hot tub']\nSunnyStates.outputs = ['Account Manager','Lifetime Spend']\n\ncompanies.search(SunnyStates)\n```\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "a fun project",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/cooper-richason/cu_api"
    },
    "split_keywords": [
        "nbdev",
        "jupyter",
        "notebook",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "29d05e2a8e6c279cb8ef2c2727fbb51284bc9eeb1b70d43ff875342a0df4575d",
                "md5": "7b24d987b940286ccd5f13ae94741b67",
                "sha256": "a67d8cf6dab7c7081e7122d87b3a7a3c4396c2c82f3ce18612ae05bc05752e58"
            },
            "downloads": -1,
            "filename": "cu_api-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7b24d987b940286ccd5f13ae94741b67",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 16458,
            "upload_time": "2024-12-28T02:34:39",
            "upload_time_iso_8601": "2024-12-28T02:34:39.985490Z",
            "url": "https://files.pythonhosted.org/packages/29/d0/5e2a8e6c279cb8ef2c2727fbb51284bc9eeb1b70d43ff875342a0df4575d/cu_api-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5bb1bf7ea1ce64a5a04a386b080f82d898a7808f75d385bae6c32b08b93d59a2",
                "md5": "01f32b710be0ce8909e7f056a975eb0e",
                "sha256": "316eee7fd1db606bad52832c50caca0288281ec0515e4bffd7fa69eb2ce51aa1"
            },
            "downloads": -1,
            "filename": "cu_api-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "01f32b710be0ce8909e7f056a975eb0e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 16523,
            "upload_time": "2024-12-28T02:34:41",
            "upload_time_iso_8601": "2024-12-28T02:34:41.882487Z",
            "url": "https://files.pythonhosted.org/packages/5b/b1/bf7ea1ce64a5a04a386b080f82d898a7808f75d385bae6c32b08b93d59a2/cu_api-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-28 02:34:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cooper-richason",
    "github_project": "cu_api",
    "github_not_found": true,
    "lcname": "cu-api"
}
        
Elapsed time: 0.49292s