If you do not know about ZoomInfo yet, it is a business intelligence search service. With it, you can find information about companies and people working in them. The great thing about ZoomInfo is they offer an API for accessing their service. I have written up a little convenience module for this API. The only requirement is lxml.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import urllib2 from lxml import objectify from urllib import urlencode apiurl = 'http://api.zoominfo.com/PartnerAPI/XmlOutput.aspx?' class ZoomInfoException(Exception): pass def zoom_query(qtype, key, **kwargs): args = { 'query_type': qtype, 'pc': key, } args.update(kwargs) resp = urllib2.urlopen(''.join([apiurl, urlencode(args)])) resptree = objectify.parse(resp).getroot() if hasattr(resptree, 'ErrorMessage'): raise ZoomInfoException, resptree.ErrorMessage return resptree def company_competitors(key, **kwargs): return zoom_query('company_competitors', key, **kwargs) def company_detail(key, **kwargs): return zoom_query('company_detail', key, **kwargs) def company_search_query(key, **kwargs): return zoom_query('company_search_query', key, **kwargs) def people_search_query(key, **kwargs): return zoom_query('people_search_query', key, **kwargs) |
This module is only 32 lines, but provides full functionality to the current ZoomInfo API. It is lacking in documentation, but it follows the API documentation to the letter. Here's some example of its use.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #!/usr/bin/env python from lxml import etree from time import sleep import zoominfo key = 'Your_API_key_here' xml = zoominfo.company_search_query(key, companyName="red hat") for rec in xml.CompanySearchResults.CompanyRecord: print rec.CompanyID, rec.CompanyName, rec.Website sleep(2) xml = zoominfo.company_detail(key, CompanyDomain='www.redhat.com') for person in xml.KeyPerson: print person.JobTitle, '-', person.FirstName, person.LastName redhatid = xml.CompanyID sleep(2) try: xml = zoominfo.company_competitors(key, CompanyID=redhatid) except zoominfo.ZoomInfoException, e: print 'Caught Error from ZoomInfo:', e print 'You need to upgrade your ZoomInfo to use this function' sleep(2) xml = zoominfo.people_search_query(key, firstName='Paul', lastName='Cormier') rec = xml.PeopleSearchResults.PersonRecord[0] print rec.CurrentEmployment.JobTitle, '@', rec.CurrentEmployment.Company.CompanyName |
If you use this module, you are still subject to ZoomInfo's use restrictions and branding requirements. This is why my example includes a few time.sleeps in between queries.
If you have any suggestions, please leave a comment.
