├── .gitignore ├── LICENSE ├── README.md ├── VERSION ├── clearbit ├── __init__.py ├── discovery.py ├── enrichment │ ├── __init__.py │ ├── company.py │ ├── person.py │ └── person_company.py ├── error.py ├── examples │ ├── discovery.py │ ├── enrichment.py │ ├── json_test.py │ ├── person.py │ ├── prospector.py │ ├── prospector_multiple_roles.py │ ├── version.py │ └── watchlist.py ├── name_to_domain.py ├── prospector.py ├── resource.py ├── reveal.py ├── risk.py ├── tests.py ├── version.py └── watchlist.py └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | dist 3 | clearbit.egg-info 4 | build 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Clearbit. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ## ⚠️ DEPRECATION WARNING 3 | 4 | This package is no longer being maintained. If you're looking to integrate with Clearbit's API we recommend looking at the HTTP requests available in our documentation at [clearbit.com/docs](https://clearbit.com/docs) 5 | 6 | # Clearbit 7 | 8 | A Python API client to [https://clearbit.com](https://clearbit.com). 9 | 10 | 11 | ## Installation 12 | 13 | To install the Clearbit Python bindings, run: 14 | 15 | pip install clearbit 16 | 17 | Or 18 | 19 | easy_install clearbit 20 | 21 | ## Usage 22 | 23 | First authorize requests by setting the API key found on your [account's settings page](https://clearbit.com/keys). 24 | 25 | ```python 26 | import clearbit 27 | clearbit.key = 'mykey' 28 | ``` 29 | 30 | You can also set the API key via the CLEARBIT_KEY environment variable. 31 | 32 | Then you can lookup people by email address. If the email's domain is corporate we'll also return a company response. 33 | 34 | ```python 35 | response = clearbit.Enrichment.find(email='alex@clearbit.com', stream=True) 36 | ``` 37 | 38 | See the [documentation](https://clearbit.com/docs#person-api) for more information. 39 | 40 | ## Company lookup 41 | 42 | You can lookup company data by domain name: 43 | 44 | ```python 45 | company = clearbit.Company.find(domain='uber.com',stream=True) 46 | ``` 47 | 48 | If the company can't be found, then `None` will be returned. 49 | 50 | See the [documentation](https://clearbit.com/docs#company-api) for more information. 51 | 52 | ## Name to Domain 53 | 54 | You can search for companies using name as a keyword: 55 | 56 | ```python 57 | response = clearbit.NameToDomain.find(name='Clearbit') 58 | ``` 59 | 60 | See the [documentation](https://clearbit.com/docs#name-to-domain-api) for more information. 61 | 62 | ## Proxy Usage 63 | 64 | Passing a proxies dictionary allows you to specify proxy servers to pass the requests through given various protocols. 65 | 66 | ```python 67 | 68 | proxies = { 69 | 'http': 'http://user:password@proxyserver.tld:8080', 70 | 'https': 'https://user:password@proxyserver.tld:8080', 71 | } 72 | 73 | response = clearbit.Enrichment.find(email='alex@clearbit.com', proxies=proxies) 74 | ``` 75 | 76 | ## Testing 77 | 78 | Set the `PYTHONPATH` env var to the current directory to load the library locally: 79 | 80 | export PYTHONPATH=. 81 | 82 | ## Deploy 83 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.1.7 2 | -------------------------------------------------------------------------------- /clearbit/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from clearbit.discovery import Discovery 4 | from clearbit.error import (ClearbitError, ParamsInvalidError) 5 | from .enrichment import Enrichment 6 | from .enrichment import Company 7 | from .enrichment import Person 8 | from .enrichment import PersonCompany 9 | from prospector import Prospector 10 | from clearbit.resource import Resource 11 | from reveal import Reveal 12 | from risk import Risk 13 | from name_to_domain import NameToDomain 14 | from clearbit.watchlist import Watchlist 15 | from clearbit.watchlist import Entity as WatchlistEntity 16 | from clearbit.watchlist import Individual as WatchlistIndividual 17 | from clearbit.watchlist import Candidate as WatchlistCandidate 18 | 19 | key = os.getenv('CLEARBIT_KEY', None) 20 | -------------------------------------------------------------------------------- /clearbit/discovery.py: -------------------------------------------------------------------------------- 1 | from clearbit.resource import Resource 2 | 3 | class Discovery(Resource): 4 | endpoint = 'https://discovery.clearbit.com/v1' 5 | 6 | @classmethod 7 | def search(cls, **options): 8 | response = cls.post('/companies/search', **options) 9 | return(response.json()) 10 | -------------------------------------------------------------------------------- /clearbit/enrichment/__init__.py: -------------------------------------------------------------------------------- 1 | from .company import Company 2 | from .person import Person 3 | from .person_company import PersonCompany 4 | 5 | class Enrichment: 6 | @classmethod 7 | def find(cls, **options): 8 | if 'domain' in options: 9 | return Company.find(**options) 10 | else: 11 | return PersonCompany.find(**options) 12 | -------------------------------------------------------------------------------- /clearbit/enrichment/company.py: -------------------------------------------------------------------------------- 1 | from clearbit.resource import Resource 2 | from clearbit.error import ParamsInvalidError 3 | 4 | class Company(Resource): 5 | endpoint = 'https://company.clearbit.com/v2/companies' 6 | 7 | @classmethod 8 | def find(cls, **options): 9 | if 'domain' in options: 10 | url = '/find' 11 | elif 'id' in options: 12 | url = '/' + options.pop('id') 13 | else: 14 | raise ParamsInvalidError('Invalid values') 15 | 16 | return cls.get(url, **options) 17 | 18 | def flag(self, **attrs): 19 | return self.post('/%s/flag' % self['id'], **attrs) 20 | -------------------------------------------------------------------------------- /clearbit/enrichment/person.py: -------------------------------------------------------------------------------- 1 | from clearbit.resource import Resource 2 | from clearbit.error import ParamsInvalidError 3 | 4 | class Person(Resource): 5 | endpoint = 'https://person.clearbit.com/v2/people' 6 | 7 | @classmethod 8 | def find(cls, **options): 9 | if 'email' in options: 10 | url = '/find' 11 | elif 'id' in options: 12 | url = '/' + options.pop('id') 13 | else: 14 | raise ParamsInvalidError('Invalid values') 15 | 16 | return cls.get(url, **options) 17 | 18 | def flag(self, **attrs): 19 | return self.post('/%s/flag' % self['id'], **attrs) 20 | -------------------------------------------------------------------------------- /clearbit/enrichment/person_company.py: -------------------------------------------------------------------------------- 1 | from clearbit.resource import Resource 2 | from clearbit.error import (ParamsInvalidError) 3 | 4 | class PersonCompany(Resource): 5 | endpoint = 'https://person.clearbit.com/v2/combined' 6 | 7 | @classmethod 8 | def find(cls, **options): 9 | if 'email' in options: 10 | url = '/find' 11 | else: 12 | raise ParamsInvalidError('Invalid values') 13 | 14 | return cls.get(url, **options) 15 | -------------------------------------------------------------------------------- /clearbit/error.py: -------------------------------------------------------------------------------- 1 | class ClearbitError(Exception): 2 | pass 3 | 4 | class ParamsInvalidError(ClearbitError): 5 | pass 6 | -------------------------------------------------------------------------------- /clearbit/examples/discovery.py: -------------------------------------------------------------------------------- 1 | import clearbit 2 | 3 | companies = clearbit.Discovery.search(query={'tech':'marketo'}, sort='alexa_asc') 4 | 5 | for company in companies['results']: 6 | print(company['name']) 7 | -------------------------------------------------------------------------------- /clearbit/examples/enrichment.py: -------------------------------------------------------------------------------- 1 | import clearbit 2 | 3 | combined = clearbit.Enrichment.find(email='alex@clearbit.com',stream=True) 4 | 5 | print(combined) 6 | -------------------------------------------------------------------------------- /clearbit/examples/json_test.py: -------------------------------------------------------------------------------- 1 | import clearbit 2 | import json 3 | 4 | combined = clearbit.Enrichment.find(email='alex@clearbit.com',stream=True) 5 | 6 | print(json.dumps(combined)) 7 | -------------------------------------------------------------------------------- /clearbit/examples/person.py: -------------------------------------------------------------------------------- 1 | import clearbit 2 | 3 | person = clearbit.Person.find(email='alex@clearbit.com',stream=True) 4 | # person.flag(given_name='Blah') 5 | 6 | print(person) 7 | -------------------------------------------------------------------------------- /clearbit/examples/prospector.py: -------------------------------------------------------------------------------- 1 | import clearbit 2 | 3 | response = clearbit.Prospector.search(domain='clearbit.com') 4 | 5 | for person in response['results']: 6 | print(person['name']['fullName']) 7 | print(person.email) 8 | -------------------------------------------------------------------------------- /clearbit/examples/prospector_multiple_roles.py: -------------------------------------------------------------------------------- 1 | import clearbit 2 | 3 | response = clearbit.Prospector.search(domain='clearbit.com', roles={'sales', 'marketing'}) 4 | 5 | for person in response['results']: 6 | print(person['name']['fullName']) 7 | print(person.email) 8 | -------------------------------------------------------------------------------- /clearbit/examples/version.py: -------------------------------------------------------------------------------- 1 | import clearbit 2 | 3 | clearbit.PersonCompany.set_version('2015-05-30') 4 | 5 | result = clearbit.PersonCompany.find(email='alex@clearbit.com',webhook_url='http://requestb.in/om0hqqom') 6 | print(result) 7 | -------------------------------------------------------------------------------- /clearbit/examples/watchlist.py: -------------------------------------------------------------------------------- 1 | import clearbit 2 | 3 | results = clearbit.WatchlistEntity.search(name='Ferland', fuzzy=True) 4 | 5 | for result in results: 6 | print(result) 7 | -------------------------------------------------------------------------------- /clearbit/name_to_domain.py: -------------------------------------------------------------------------------- 1 | from clearbit.resource import Resource 2 | from clearbit.error import (ParamsInvalidError) 3 | 4 | class NameToDomain(Resource): 5 | endpoint = 'https://company.clearbit.com/v1/domains' 6 | 7 | @classmethod 8 | def find(cls, **options): 9 | return cls.get('/find', **options) 10 | -------------------------------------------------------------------------------- /clearbit/prospector.py: -------------------------------------------------------------------------------- 1 | from clearbit.resource import Resource 2 | 3 | class Prospector(Resource): 4 | endpoint = 'https://prospector.clearbit.com/v1' 5 | 6 | @classmethod 7 | def search(cls, **options): 8 | return cls.get('/people/search', **options) 9 | 10 | @property 11 | def email(self): 12 | return self.getEmailResponse()['email'] 13 | 14 | @property 15 | def verified(self): 16 | return self.getEmailResponse()['verified'] 17 | 18 | email_response = None 19 | 20 | def getEmailResponse(self): 21 | if (self.email_response): 22 | return self.email_response 23 | 24 | self.email_response = self.get('/people/%s/email' % self['id']) 25 | return self.email_response 26 | -------------------------------------------------------------------------------- /clearbit/resource.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import clearbit 3 | 4 | class Resource(dict): 5 | endpoint = '' 6 | options = {} 7 | valid_options = ['params', 'key', 'headers', 'stream'] 8 | 9 | @classmethod 10 | def set_version(cls, value): 11 | cls.options['headers'] = {'API-Version': value} 12 | 13 | @classmethod 14 | def new(cls, item): 15 | if isinstance(item, list): 16 | return (cls(rec) for rec in item) 17 | else: 18 | return cls(item) 19 | 20 | @classmethod 21 | def extract_options(cls, values): 22 | options = {k: v for k, v in values.items() if k in cls.valid_options} 23 | options.update(cls.options) 24 | 25 | params = {k: v for k, v in values.items() if k not in cls.valid_options} 26 | for k in list(params): 27 | if isinstance(params[k], list): 28 | params[k + '[]'] = params.pop(k) 29 | 30 | options.setdefault('params', {}).update(params) 31 | 32 | key = options.pop('key', clearbit.key) 33 | options['auth'] = key, '' 34 | 35 | return options 36 | 37 | @classmethod 38 | def get(cls, url, **values): 39 | options = cls.extract_options(values) 40 | 41 | endpoint = cls.endpoint + url 42 | 43 | if options.pop('stream', False): 44 | endpoint = endpoint.replace('.', '-stream.', 1) 45 | 46 | response = requests.get(endpoint, **options) 47 | 48 | if response.status_code == 200: 49 | return cls.new(response.json()) 50 | if response.status_code == 202: 51 | return cls({ 'pending': True }) 52 | elif response.status_code == requests.codes.not_found: 53 | return None 54 | else: 55 | response.raise_for_status() 56 | 57 | @classmethod 58 | def post(cls, url, **values): 59 | options = cls.extract_options(values) 60 | endpoint = cls.endpoint + url 61 | 62 | # Always post as a JSON object 63 | options['json'] = options.pop('params', {}) 64 | 65 | response = requests.post(endpoint, **options) 66 | response.raise_for_status() 67 | 68 | return response 69 | 70 | @classmethod 71 | def delete(cls, url, **values): 72 | options = cls.extract_options(values) 73 | endpoint = cls.endpoint + url 74 | 75 | response = requests.delete(endpoint, **options) 76 | response.raise_for_status() 77 | 78 | return response 79 | -------------------------------------------------------------------------------- /clearbit/reveal.py: -------------------------------------------------------------------------------- 1 | from clearbit.resource import Resource 2 | from clearbit.error import (ParamsInvalidError) 3 | 4 | class Reveal(Resource): 5 | endpoint = 'https://reveal.clearbit.com/v1/companies' 6 | 7 | @classmethod 8 | def find(cls, **options): 9 | return cls.get('/find', **options) 10 | -------------------------------------------------------------------------------- /clearbit/risk.py: -------------------------------------------------------------------------------- 1 | from clearbit.resource import Resource 2 | 3 | class Risk(Resource): 4 | endpoint = 'https://risk.clearbit.com/v1' 5 | 6 | @classmethod 7 | def calculate(cls, **options): 8 | response = cls.post('/calculate', **options) 9 | return(response) 10 | 11 | @classmethod 12 | def flag(cls, **options): 13 | response = cls.post('/flag', **options) 14 | return(response) 15 | -------------------------------------------------------------------------------- /clearbit/tests.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import unittest 3 | 4 | if sys.version_info > (3, 3): 5 | from unittest.mock import patch 6 | else: 7 | from mock import patch 8 | 9 | import clearbit 10 | from clearbit import * 11 | 12 | clearbit.key = 'k' 13 | 14 | class TestResource(unittest.TestCase): 15 | @patch('clearbit.resource.requests') 16 | def test_clearbit_key(self, requests): 17 | Resource.get('http://x.clearbit.com/test', key='mykey') 18 | requests.get.assert_called_with('http://x.clearbit.com/test', params={}, auth=('mykey', '')) 19 | 20 | @patch('clearbit.resource.requests') 21 | def test_stream(self, requests): 22 | Resource.get('http://x.clearbit.com/test', stream=True) 23 | requests.get.assert_called_with('http://x-stream.clearbit.com/test', params={}, auth=('k', '')) 24 | 25 | class TestPerson(unittest.TestCase): 26 | @patch('clearbit.resource.requests') 27 | def test_webhook_url(self, requests): 28 | Person.find(email='user@example.com', webhook_url='http://webhook.com/webhook') 29 | requests.get.assert_called_with('https://person.clearbit.com/v2/people/find', params={'email': 'user@example.com', 'webhook_url': 'http://webhook.com/webhook'}, auth=('k', '')) 30 | 31 | @patch('clearbit.resource.requests') 32 | def test_webhook_id(self, requests): 33 | Person.find(email='user@example.com', webhook_id='myid') 34 | requests.get.assert_called_with('https://person.clearbit.com/v2/people/find', params={'email': 'user@example.com', 'webhook_id': 'myid'}, auth=('k', '')) 35 | 36 | @patch('clearbit.resource.requests') 37 | def test_subscribe(self, requests): 38 | Person.find(email='user@example.com', subscribe=True) 39 | requests.get.assert_called_with('https://person.clearbit.com/v2/people/find', params={'email': 'user@example.com', 'subscribe': True}, auth=('k', '')) 40 | 41 | @patch('clearbit.resource.requests') 42 | def test_endpoint(self, requests): 43 | Person.find(email='user@example.com') 44 | requests.get.assert_called_with('https://person.clearbit.com/v2/people/find', params={'email': 'user@example.com'}, auth=('k', '')) 45 | 46 | @patch('clearbit.resource.requests') 47 | def test_find_by_id(self, requests): 48 | Person.find(id='theid') 49 | requests.get.assert_called_with('https://person.clearbit.com/v2/people/theid', params={}, auth=('k', '')) 50 | 51 | @patch('clearbit.resource.requests') 52 | def test_flag(self, requests): 53 | person = Person(id='theid') 54 | person.flag(given_name='John') 55 | requests.post.assert_called_with('https://person.clearbit.com/v2/people/theid/flag', json={'given_name': 'John'}, auth=('k', '')) 56 | 57 | class TestCompany(unittest.TestCase): 58 | @patch('clearbit.resource.requests') 59 | def test_webhook_url(self, requests): 60 | Company.find(domain='example.com', webhook_url='http://webhook.com/webhook') 61 | requests.get.assert_called_with('https://company.clearbit.com/v2/companies/find', params={'domain': 'example.com', 'webhook_url': 'http://webhook.com/webhook'}, auth=('k', '')) 62 | 63 | @patch('clearbit.resource.requests') 64 | def test_webhook_id(self, requests): 65 | Company.find(domain='example.com', webhook_id='myid') 66 | requests.get.assert_called_with('https://company.clearbit.com/v2/companies/find', params={'domain': 'example.com', 'webhook_id': 'myid'}, auth=('k', '')) 67 | 68 | @patch('clearbit.resource.requests') 69 | def test_subscribe(self, requests): 70 | Company.find(domain='example.com', subscribe=True) 71 | requests.get.assert_called_with('https://company.clearbit.com/v2/companies/find', params={'domain': 'example.com', 'subscribe': True}, auth=('k', '')) 72 | 73 | @patch('clearbit.resource.requests') 74 | def test_endpoint(self, requests): 75 | Company.find(domain='example.com') 76 | requests.get.assert_called_with('https://company.clearbit.com/v2/companies/find', params={'domain': 'example.com'}, auth=('k', '')) 77 | 78 | @patch('clearbit.resource.requests') 79 | def test_find_by_id(self, requests): 80 | Company.find(id='theid') 81 | requests.get.assert_called_with('https://company.clearbit.com/v2/companies/theid', params={}, auth=('k', '')) 82 | 83 | @patch('clearbit.resource.requests') 84 | def test_flag(self, requests): 85 | company = Company(id='theid') 86 | company.flag(name='ACME Inc') 87 | requests.post.assert_called_with('https://company.clearbit.com/v2/companies/theid/flag', json={'name': 'ACME Inc'}, auth=('k', '')) 88 | 89 | class TestEnrichment(unittest.TestCase): 90 | @patch('clearbit.resource.requests') 91 | def test_webhook_url(self, requests): 92 | Enrichment.find(email='user@example.com', webhook_url='http://webhook.com/webhook') 93 | requests.get.assert_called_with('https://person.clearbit.com/v2/combined/find', params={'email': 'user@example.com', 'webhook_url': 'http://webhook.com/webhook'}, auth=('k', '')) 94 | 95 | @patch('clearbit.resource.requests') 96 | def test_webhook_id(self, requests): 97 | Enrichment.find(email='user@example.com', webhook_id='myid') 98 | requests.get.assert_called_with('https://person.clearbit.com/v2/combined/find', params={'email': 'user@example.com', 'webhook_id': 'myid'}, auth=('k', '')) 99 | 100 | @patch('clearbit.resource.requests') 101 | def test_subscribe(self, requests): 102 | Enrichment.find(email='user@example.com', subscribe=True) 103 | requests.get.assert_called_with('https://person.clearbit.com/v2/combined/find', params={'email': 'user@example.com', 'subscribe': True}, auth=('k', '')) 104 | 105 | @patch('clearbit.resource.requests') 106 | def test_endpoint(self, requests): 107 | Enrichment.find(email='user@example.com') 108 | requests.get.assert_called_with('https://person.clearbit.com/v2/combined/find', params={'email': 'user@example.com'}, auth=('k', '')) 109 | 110 | class TestProspector(unittest.TestCase): 111 | @patch('clearbit.resource.requests') 112 | def test_search(self, requests): 113 | Prospector.search(domain='example.com') 114 | requests.get.assert_called_with('https://prospector.clearbit.com/v1/people/search', params={'domain': 'example.com'}, auth=('k', '')) 115 | 116 | @patch('clearbit.resource.requests') 117 | def test_search_titles(self, requests): 118 | Prospector.search(domain='example.com', titles=['Sales Director', 'Marketing Director']) 119 | requests.get.assert_called_with('https://prospector.clearbit.com/v1/people/search', params={'domain': 'example.com', 'titles[]': ['Sales Director', 'Marketing Director']}, auth=('k', '')) 120 | 121 | class TestNameToDomain(unittest.TestCase): 122 | @patch('clearbit.resource.requests') 123 | def test_find(self, requests): 124 | NameToDomain.find(name='Uber') 125 | requests.get.assert_called_with('https://company.clearbit.com/v1/domains/find', params={'name': 'Uber'}, auth=('k', '')) 126 | 127 | if __name__ == '__main__': 128 | unittest.main() 129 | -------------------------------------------------------------------------------- /clearbit/version.py: -------------------------------------------------------------------------------- 1 | VERSION = '0.1.6' 2 | -------------------------------------------------------------------------------- /clearbit/watchlist.py: -------------------------------------------------------------------------------- 1 | from clearbit.resource import Resource 2 | 3 | class Watchlist(Resource): 4 | endpoint = 'https://watchlist.clearbit.com/v1' 5 | 6 | @classmethod 7 | def search(cls, **options): 8 | if 'path' in options: 9 | path = options.pop('path') 10 | else: 11 | path = '/search/all' 12 | 13 | response = cls.post(path, **options) 14 | 15 | return(cls(item) for item in response.json()) 16 | 17 | class Individual(Watchlist): 18 | @classmethod 19 | def search(cls, **options): 20 | return super(Individual, cls).search(path='/search/individuals', **options) 21 | 22 | class Entity(Watchlist): 23 | @classmethod 24 | def search(cls, **options): 25 | return super(Entity, cls).search(path='/search/entities', **options) 26 | 27 | class Candidate(Resource): 28 | endpoint = 'https://watchlist.clearbit.com/v1' 29 | 30 | @classmethod 31 | def all(cls): 32 | return cls.get('/candidates') 33 | 34 | @classmethod 35 | def create(cls, **params): 36 | response = cls.post('/candidates', params=params) 37 | 38 | return cls(response.json()) 39 | 40 | @classmethod 41 | def find(cls, id): 42 | return cls.get('/%s' % id) 43 | 44 | def destroy(self): 45 | return self.__class__.delete('/candidates/%s' % self['id']) 46 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import warnings 4 | 5 | try: 6 | from setuptools import setup 7 | except ImportError: 8 | from distutils.core import setup 9 | 10 | try: 11 | from distutils.command.build_py import build_py_2to3 as build_py 12 | except ImportError: 13 | from distutils.command.build_py import build_py 14 | 15 | path, script = os.path.split(sys.argv[0]) 16 | os.chdir(os.path.abspath(path)) 17 | 18 | install_requires = [] 19 | install_requires.append('requests >= 0.8.8') 20 | 21 | # Don't import clearbit module here, since deps may not be installed 22 | sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'clearbit')) 23 | from version import VERSION 24 | 25 | # Get simplejson if we don't already have json 26 | if sys.version_info < (3, 0): 27 | try: 28 | from util import json 29 | except ImportError: 30 | install_requires.append('simplejson') 31 | 32 | def read(*paths): 33 | """Build a file path from *paths* and return the contents.""" 34 | with open(os.path.join(*paths), 'r') as f: 35 | return f.read() 36 | 37 | setup( 38 | name='clearbit', 39 | cmdclass={'build_py': build_py}, 40 | version=VERSION, 41 | description='Clearbit python bindings', 42 | long_description=read('README.rst'), 43 | author='Clearbit', 44 | author_email='support@clearbit.com', 45 | url='https://clearbit.com', 46 | packages=['clearbit', 'clearbit.enrichment'], 47 | package_data={'clearbit': ['../VERSION']}, 48 | install_requires=install_requires, 49 | use_2to3=True, 50 | include_package_data=True, 51 | test_suite='tests', 52 | classifiers=[ 53 | "Development Status :: 5 - Production/Stable", 54 | "Intended Audience :: Developers", 55 | "License :: OSI Approved :: MIT License", 56 | "Operating System :: OS Independent", 57 | "Programming Language :: Python", 58 | "Programming Language :: Python :: 2", 59 | "Programming Language :: Python :: 2.6", 60 | "Programming Language :: Python :: 2.7", 61 | "Programming Language :: Python :: 3", 62 | "Programming Language :: Python :: 3.2", 63 | "Programming Language :: Python :: 3.3", 64 | "Programming Language :: Python :: Implementation :: PyPy", 65 | "Topic :: Software Development :: Libraries :: Python Modules", 66 | ]) 67 | --------------------------------------------------------------------------------