Package: rocketreach
Getting StartedThis is a simple Python binding for the RocketReach API (https://rocketreach.co/api).RequirementsPython 3.4+.InstallationYou can install this package using pip:$ pip install rocketreachTestingIncludes a simple driver file,main.pywhich 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 existsNote 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-isample/sample01.csv-osample01_lookup_output.csv-k<YOURAPIKEYHERE>SetupSign up for RocketReach athttps://rocketreach.co/signup.Documentation for the API and python bindings available at the official API documentation page:https://rocketreach.co/api.UsageConfigurationProvide 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 orNoneand 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 defaultGatewayConfig:import rocketreach
rr = rocketreach.Gateway(api_key='my-api-key')SearchesAfter 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 theparams()method and provide astartand/orsize: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)LookupsTo lookup a person, provide anidorlinkedin_url. Note that not all people will have anid, 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 anidwhich can be used to check the lookup progress via thecheckStatus()method.By default, thelookupmethod is blocking and will add the person to your account's lookups as well
as pollcheckStatusuntil 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)Check StatusIf you prefer not to block on lookups, passblock=Falseand use thecheckStatusmethod 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.
UsingcheckStatusis the easiest way to find when the person's contact information has been found.When callingcheckStatuskeep 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)