Package: py-crunchbase-api
PyCrunchbasePyCrunchbase is a python client for Crunchbase'sREST API.
Crunchbase provides 4 types of APIs:-Search APIAutocomplete APIDeleted Entities APIEntities APIPyCrunchbase supports all of these through a very simple interface.InstallationUse the package managerpipto install PyCrunchbase.pipinstallpy-crunchbase-apiUsagefrompy_crunchbaseimportPyCrunchbase# API key can be set as the env variable PY_CRUNCHBASE_API_KEYpycb=PyCrunchbase()# OR passed as an argumentpycb=PyCrunchbase('api_key')# If both are provided, the latter will take preferenceSearch APIFind funding rounds since 2012 that have 4+ investors & raised $10M+ USDfrompy_crunchbaseimportPyCrunchbasefrompy_crunchbase.apis.search.predicatesimportCurrencypycb=PyCrunchbase()api=pycb.search_funding_rounds_api()api.select('identifier','announced_on','funded_organization_identifier','money_raised','investment_type').where(announced_on__gte=2012,num_investors__lte=4,money_raised__gte=Currency(10000000)).order_by('announced_on')forpageinapi.iterate():forfunding_roundinpage:print(funding_round.permalink)Find companies in Europe w/ $25M-$100M USD in fundingfrompy_crunchbaseimportPyCrunchbase,Entitiesfrompy_crunchbase.apis.search.predicatesimportCurrencypycb=PyCrunchbase()api=pycb.search_organizations_api()org_facet_ids=Entities.Organization.Facetsapi.select('identifier','categories','location_identifiers','short_description','rank_org').where(funding_total__between=[Currency(25000000),Currency(100000000)],location_identifiers__includes=['6106f5dc-823e-5da8-40d7-51612c0b2c4e'],facet_ids__includes=[org_facet_ids.company]).order_by('rank_org')forpageinapi.iterate():forcompanyinpage:print(company.permalink)Find Biotech companies w/ 101-250 number of employeesfrompy_crunchbaseimportPyCrunchbasepycb=PyCrunchbase()api=pycb.search_organizations_api()api.select('identifier','categories','location_identifiers','short_description','rank_org').where(num_employees_enum__includes=['c_00101_00250'],categories__includes=['58842728-7ab9-5bd1-bb67-e8e55f6520a0']).order_by('rank_org')forpageinapi.iterate():forcompanyinpage:print(company.permalink)Autocomplete APIFind any entities that best matches "box"frompy_crunchbaseimportPyCrunchbasepycb=PyCrunchbase()api=pycb.autocomplete_api()forentityinapi.autocomplete('box').limit(15).execute():print(entity.permalink,entity.uuid)Find an investor that best matches "mayfield"frompy_crunchbaseimportPyCrunchbase,Collectionspycb=PyCrunchbase()api=pycb.autocomplete_api()forentityinapi.autocomplete('mayfield').select_collections(Collections.Principals.investors).execute():print(entity.permalink,entity.uuid)Find a category or category group that best matches "mobile payment"frompy_crunchbaseimportPyCrunchbase,Collectionspycb=PyCrunchbase()api=pycb.autocomplete_api()forentityinapi.autocomplete('mobile payment').select_collections(Collections.Categories,Collections.CategoryGroups).limit(10).execute():print(entity.permalink,entity.uuid)Find a company that best matches "airbnb"frompy_crunchbaseimportPyCrunchbase,Collectionspycb=PyCrunchbase()api=pycb.autocomplete_api()forentityinapi.autocomplete('airbnb').select_collections(Collections.Organizations.companies).execute():print(entity.permalink,entity.uuid)Find a country or city that best matches "united"frompy_crunchbaseimportPyCrunchbase,Collectionspycb=PyCrunchbase()api=pycb.autocomplete_api()forentityinapi.autocomplete('united').select_collections(Collections.Locations.countries,Collections.Locations.cities).limit(10).execute():print(entity.permalink,entity.uuid)Deleted Entities APIfrompy_crunchbaseimportPyCrunchbase,Collectionspycb=PyCrunchbase()api=pycb.deleted_entities_api()forpageinapi.select_collections(Collections.Organizations,Collections.People,Collections.FundingRounds,Collections.Events).order_by_deleted_at().iterate():forentityinpage:print(entity.uuid,entity.deleted_at)Entities APIRetrieve information for Tesla Motorsfrompy_crunchbaseimportPyCrunchbase,Cardspycb=PyCrunchbase()org_api=pycb.organizations_api()cards=Cards.Organizationentity=org_api.get(entity_id='tesla-motors',field_ids=['website','facebook','categories','short_description','founded_on','rank_org_company'],card_ids=[cards.founders,cards.raised_funding_rounds])print(entity.website,entity.cards)Get more results for Sequoia Capital's investmentsfrompy_crunchbaseimportPyCrunchbase,Cardspycb=PyCrunchbase()org_api=pycb.organizations_api()cards=Cards.Organizationcard_list=org_api.get_cards(entity_id='sequoia-capital',card_id=cards.participated_investments,card_field_ids=['announced_on','funding_round_money_raised','organization_identifier','partner_identifiers'],order_by=('funding_round_money_raised','desc'))forcardincard_list:print(card.uuid)ExtrasEntitiesEach Crunchbase Entity has its own class and can be accessed throughEntitiesfrompy_crunchbaseimportEntitiesOrganization=Entities.OrganizationPerson=Entities.PersonEntity classes can be extended through a decoratorfrompy_crunchbaseimportEntitiesfrompy_crunchbase.decoratorsimportoverride_entity@override_entity(Entities.Organization)classCustomOrganization(Entities.Organization):pass# now Entities.Organization will return CustomOrganizationCardsEach Entity class defines its own cards (if any) and can be accessed throughCardsfrompy_crunchbaseimportCardsOrgCards=Cards.Organizationprint(OrgCards.investors)print(OrgCards.founders)# all available Org cardsprint(OrgCards.all())CollectionsCollections are also defined in Entity class and can be accessed throughCollectionsfrompy_crunchbaseimportCollectionsOrgCol=Collections.Organizationsprint(OrgCol.companies)print(OrgCol.schools)Exception HandlingThere are two ways to catch exceptionsfrompy_crunchbaseimportPyCrunchbase,CrunchbaseAPIExceptionpycb=PyCrunchbase()api=pycb.autocomplete_api()try:entities=api.autocomplete('box').limit(15).execute()exceptapi.Exception:pass# OR through CrunchbaseAPIExceptiontry:entities=api.autocomplete('box').limit(15).execute()exceptCrunchbaseAPIException:passContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.LicenseMIT