Python bindings for RocketReach API
This is a simple Python binding for the RocketReach API (https://rocketreach.co/api).
You can install this package using pip:
$ pip install rocketreach
Includes a simple driver file,
main.py which accepts 3 required arguments:
-i <input csv>
-o <output csv>
-k <api key>
The input csv is a 2 column csv with name (column 1) and company (column 2). The script loads the csv and does a lookup on each row, writing the results to output csv.
Note that this will overwrite the output file if it exists
Note this may charge the account associated with the API Key for any lookups incurred.
A sample csv is included in the sample directory. You can run it by
$ ./main.py -i sample/sample01.csv -o sample01_lookup_output.csv -k <YOUR API KEY HERE>
Sign up for RocketReach at https://rocketreach.co/signup.
Documentation for the API and python bindings available at the official API documentation page: https://rocketreach.co/api.
Provide your api key and environment to get started. The default environment, production is usually sufficient to get started.
If you want to use the test key, leave the API key parameter blank or
None and set the environment to Sandbox.
import rocketreach config = rocketreach.GatewayConfig(None, rocketreach.GatewayEnvironment.sandbox) rr = rocketreach.Gateway(config) result = rr.account.get() if result.is_success: print(result.account)
Or use the short-hand arguments and use the default
import rocketreach rr = rocketreach.Gateway(api_key='my-api-key')
After configuring your gateway perform RocketReach searches:
import rocketreach rr = rocketreach.Gateway(rocketreach.GatewayConfig('api-key')) s = rr.person.search().filter(current_employer='Acme', current_title='CEO') result = s.execute() for person in result.people: print(person)
To paginate search queries, call the
params() method and provide a
import rocketreach rr = rocketreach.Gateway(rocketreach.GatewayConfig('api-key')) s = rr.person.search().filter(current_employer='Acme', current_title='CEO') s = s.params(start=11, size=25) result = s.execute() for person in result.people: print(person)
To lookup a person, provide an
linkedin_url. Note that not all people will have an
id, so be sure
to allow the flexibility to use either attribute. At least one is garuanteed to exist. After a succesful lookup,
a person is gauranteed to have an
id which can be used to check the lookup progress via the
By default, the
lookup method is blocking and will add the person to your account's lookups as well
checkStatus until the lookup has completed.
import rocketreach rr = rocketreach.Gateway(rocketreach.GatewayConfig('api-key')) result = rr.person.lookup(person_id=123) print(result.person) result = rr.person.lookup(linkedin_url='https://www.linkedin.com/in/john-doe-example') print(result.person)
If you prefer not to block on lookups, pass
block=False and use the
checkStatus method manually.
Note that RocketReach does not block the lookup API endpoint, instead the system will mark the lookup as
added to your account and will begin searching for contact information in the background. The system may
finish the lookup inline in some instances, but in the majority of cases the person status will be incomplete.
checkStatus is the easiest way to find when the person's contact information has been found.
checkStatus keep in mind that tight loops are best avoided, and may result in a rate limiting
error, indicated by a 429 status code. If a request fails with that status code, you can check the error
message to see how long to wait for your next request -- usually just a few seconds.
import rocketreach rr = rocketreach.Gateway(rocketreach.GatewayConfig('api-key')) result = rr.person.lookup(person_id=123, block=False) while result.status != PersonLookupStatus.complete: result = rr.person.check_status([result.person.id]) if not result.is_success and result.response.status_code == 429: time.sleep(1)
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size rocketreach-2.1.2-py3.6.egg (10.5 kB)||File type Egg||Python version 3.6||Upload date||Hashes View|
|Filename, size rocketreach-2.1.2.tar.gz (8.9 kB)||File type Source||Python version None||Upload date||Hashes View|