Python bindings to CrunchBase
Python bindings to CrunchBase
Starting from v0.3.0, pycrunchbase has support for CrunchBase API version 3, but things are still flaky, so any kind of bug reports is greatly appreciated, for detail see notes below.
Note: I currently do not need to use this library, so it’s feature-complete for me. Bug reports are welcome, and pull requests for features are still accepted.
Initialize the API using your API Key, will throw ValueError if missing
cb = CrunchBase(API_KEY)
Look up an organization by name
github = cb.organization('github')
The response contains snippets of data regarding relationships that the organization has, an example is the funding_rounds
funding_rounds_summary = github.funding_rounds
All relationships are paged, and only 8 is returned initially to get more data do this, it handles paging for you and returns a False-y value if there are no more pages
more_funding_rounds = cb.more(funding_rounds_summary)
Data in relations are just summaries, and you probably want more details For example funding_rounds returns 5 values: type, name, path created_at, updated_at.
If you actually want to know who invested, you have to get to make more API calls.
First get the uuid of the round
round_uuid = funding_rounds_summary.uuid
Then use the CrunchBase API to make that call
round = cb.funding_round(round_uuid)
Again, investments is a relationship on a FundingRound, so we can get the first item in that relationship
an_investor = round.investments # a Investment
And printing that gives us the name of the investor, and the amount invested in USD
print(str(an_investor)) # prints: Investment: [Organization: Name]
pip install pycrunchbase
To run the all tests run:
Contributions are always welcome! Visit pycrunchbase’s Homepage <https://github.com/ngzhian/pycrunchbase/>
Use GitHub issues to report a bug or send feedback.
The best way to send feedback is to file an issue at https://github.com/ngzhian/pycrunchbase/issues.
Thanks to these contributors:
Support all (or almost all) of CrunchBase’s API functionalities
Speedy updates when CrunchBase’s API changes
‘Pythonic’ bindings, user doesn’t feel like we’re requesting URLs
Notes on CrunchBase version 3 changes
In version 3, CrunchBase changed the names of some endpoints, e.g person -> people, and they have gone with the plural form of all entities. pycrunchbase does not adhere strictly to that. For example, there is still a person method, but a people method is also provided so that it remains backwards compatible and also supports methods that matches the name of the entity.
0.3.9 (2020-12-02) * FLexible requests/six versions (#35)
0.3.8 (2017-2-9) * Fix #26 encode url if it has special entities
0.3.7 (2016-1-13) * Added profile_image_url known property to Organization, Person, and Product per CB-5541 bugfix from 2015-10-21 * Added featured_team relationship for Organization per Crunchbase change on 2016-06-22 * Added known properties is_current for Job and is_lead_investor for Investment per CB-9048 on 2016-10-14 * Fixed typos in addnode.rst * Added David Tran to AUTHORS.rst
0.3.6 (2015-10-21) * Alias ‘PressReference’ to news * Fix checking for the type of a PageItem, use lowercase compare * Update test data, those were out of sync with what CrunchBase no returns. Specifically the test data for Fund and Relationship (Organization.past_team)
0.3.5 (2015-09-28) * Fixed handling null rleationships that api returns * Update setup.py release alias
0.3.4 (2015-09-27) * Fixed instructions in usage.rst (#20) * Support nested relationships FundingRound -> Investments -> Organization * Update README
Added stock_exchange as a known property of Organization, ref #19 <https://github.com/ngzhian/pycrunchbase/issues/19>
New resource type StockExchange (fixes #18)
Better __str__ for IPO
Bug fix when relationship data returned from crunchbase is [null]. Thanks @karlalopez
Updated to support version 3 of CrunchBase API
Fix endpoint urls, e.g. ‘funding-round’ -> ‘funding-rounds’
Internal cleanups, Page now subclass Relationship
Fixed: #9 sub_organization and websites relationship of Organization
Fixed: #8 printing PageItem leads to unbounded recursion (@dustinfarris)
Added: Locations - get a list of active locations from CrunchBase
Added: LocationPageItem - each location in the Page of Locations
Added: Categories - get a list of active categories from CrunchBase
Added: CategoryPageItem - each location in the Page of Categories
Added: IPO - you can now use a uuid to grab IPO data
Fix: Travis builds and tests
Fix: Unicode output (using UTF-8 encoding)
The API is now considered relatively stabled. Updated the classifier to reflect so
Change to how CrunchBase.more reacts to a Relationship, we no longer optimize when the Relationship has all items, just call first_page_url
Add series to the FundingRound node.
Update __str__ for nodes and relationships
Relationship is now a subclass of Page, although this strictly isn’t true. The benefit is that this allows us to reuse a lot of logic. Relationship can be thought of as Page 0, which is a summary of potentially multiple pages of PageItem. The only time we get a relationship is when we query for a particular Node, e.g. organiation, and we grab the relationships returned by the API. After this, to get more details we call Crunchbase.more, and this returns us a Page.
Added __repr__ methods to all the Node, Relationship, PageItem. Previously we only defined __str__, but these didn’t show up in places like the REPL. This fixes that. We try to make it obvious what object it is based on what is printed, but also don’t want to be too verbose.
InvestorInvestmentPageItem now has the possibility of being either a investor, or a invested_in relationship
Propogates any exception when making the actual HTTP call to CrunchBase
Add a cb_url attribute for all PageItem, this url is a CrunchBase page (not the API) that holds more information for a particular PageItem Allows you to make calls like:
to get the url of the page for the first funding round of company.
A new page item, InvestorInvestmentPageItem, that is useful for FundingRound info:
round = cb.funding_round('round_uuid') an_investor = round.investments # a InvestorInvestmentPageItem print(str(an_investor)) # prints: Investor Name $100000
Add simplified Contribution guidelines in README
Relationship retrieval is 0-based now, 1-based just doesn’t fit well with array
Better __str__ for Node and Relationship
Relationship.get(i) if i is too large or small will return a NonePageItem singleton
Fix Relationship: wasn’t using the right build method of PageItem
Add test to checkk for the above
remove unused reference to CrunchBase in Relationship
PageItem and it’s subclasses to represent an item within a relationship of a Node
Cleanup of where utility methods live (parse_date)
More tests as always, overall 98.21% coverage
First release on PyPI.
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.
Hashes for pycrunchbase-0.3.9-py2.py3-none-any.whl