https://github.com/mearman/openalex-python
https://github.com/mearman/openalex-python
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mearman/openalex-python
- Owner: Mearman
- Created: 2024-01-14T14:15:54.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-04T05:12:23.000Z (over 1 year ago)
- Last Synced: 2025-03-27T01:09:34.167Z (9 months ago)
- Language: Python
- Size: 1.36 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.ipynb
- Citation: CITATION.cff
Awesome Lists containing this project
README
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# OpenAlex API\n",
"\n",
"\n",
"**OpenAlex** is a fully open catalog of the global research system.\n",
"\n",
"It's named after the [ancient Library of Alexandria](https://en.wikipedia.org/wiki/Library_of_Alexandria) and made by the nonprofit [OurResearch](https://ourresearch.org/).\n",
"\n",
"## OpenAPI Specification\n",
"\n",
"[Mearman/openalex-api-spec](https://github.com/Mearman/openalex-api-spec)\n",
"\n",
"This OpenAPI specification is reverse-engineered and derived from spec generated by [openapi-devtools](https://github.com/AndrewWalsh/openapi-devtools).\n",
"\n",
"The specification document itself is OpenAPI version 3.1 and is generated from TypeScript source code.\n",
"\n",
"[](https://mearman.github.io/openalex-swagger-ui-react/)\n",
"\n",
"**[Releases](https://github.com/Mearman/openalex-api-spec/releases)**\n",
"\n",
"## Clients\n",
"\n",
"[](https://github.com/Mearman/openalex-typescript)\n",
"\n",
"[](https://github.com/Mearman/openalex-typescript-fetch)\n",
"\n",
"[](https://github.com/Mearman/openalex-typescript-node)\n",
"\n",
"[](https://github.com/Mearman/openalex-python)\n",
"[](https://codespaces.new/Mearman/openalex-python)\n",
"[](https://colab.research.google.com/github/Mearman/openalex-python/blob/main/README.ipynb)\n",
"\n",
"---\n",
"\n",
"This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:\n",
"\n",
"- API version: 0.1.0\n",
"- Package version: 0.1.0\n",
"- Build package: org.openapitools.codegen.languages.PythonClientCodegen\n",
"\n",
"## Requirements.\n",
"\n",
"Python 3.7+\n",
"\n",
"## Installation & Usage\n",
"### pip install\n",
"\n",
"If the python package is hosted on a repository, you can install directly using:\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"metadata": {},
"source": [
"%%bash\n",
"pip install git+https://github.com/Mearman/openalex-python.git\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/Mearman/openalex-python.git`)\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"### Tests\n",
"\n",
"Execute `pytest` to run the tests.\n",
"\n",
"## Getting Started\n",
"\n",
"Please follow the [installation procedure](#installation--usage) and then run the following:\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"metadata": {},
"source": [
"\n",
"import time\n",
"import openalex_api\n",
"from openalex_api.rest import ApiException\n",
"from pprint import pprint\n",
"\n",
"# Defining the host is optional and defaults to https://api.openalex.org\n",
"# See configuration.py for a list of all supported configuration parameters.\n",
"configuration = openalex_api.Configuration(\n",
" host = \"https://api.openalex.org\"\n",
")\n",
"\n",
"\n",
"\n",
"# Enter a context with an instance of the API client\n",
"with openalex_api.ApiClient(configuration) as api_client:\n",
" # Create an instance of the API class\n",
" api_instance = openalex_api.AuthorsApi(api_client)\n",
" id = 'id_example' # str | \n",
" select = 'select_example' # str | (optional)\n",
" user_agent = None # object | [docs.openalex.org/how-to-use-the-api/rate-limits-and-authentication](https://docs.openalex.org/how-to-use-the-api/rate-limits-and-authentication#the-polite-pool) (optional)\n",
" mailto = None # object | The API is the primary way to get OpenAlex data. It's free and requires no authentication. The daily limit for API calls is 100,000 requests per user per day. For best performance, add your email to all API requests The email can be either in the query string, like `mailto:example@domain.com`, or in the User-Agent request header, like `User-Agent: my-app (mailto:example@domain.com)`. Read more about the polite pool at [docs.openalex.org/how-to-use-the-api/rate-limits-and-authentication](https://docs.openalex.org/how-to-use-the-api/rate-limits-and-authentication#the-polite-pool). (optional)\n",
"\n",
" try:\n",
" # Get Author\n",
" api_response = api_instance.get_author(id, select=select, user_agent=user_agent, mailto=mailto)\n",
" print(\"The response of AuthorsApi->get_author:\\n\")\n",
" pprint(api_response)\n",
" except ApiException as e:\n",
" print(\"Exception when calling AuthorsApi->get_author: %s\\n\" % e)\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"## Documentation for API Endpoints\n",
"\n",
"All URIs are relative to *https://api.openalex.org*\n",
"\n",
"Class | Method | HTTP request | Description\n",
"------------ | ------------- | ------------- | -------------\n",
"*AuthorsApi* | [**get_author**](docs/AuthorsApi.md#get_author) | **GET** /authors/{id} | Get Author\n",
"*AuthorsApi* | [**get_authors**](docs/AuthorsApi.md#get_authors) | **GET** /authors | List Authors\n",
"*AuthorsApi* | [**get_autocomplete_authors**](docs/AuthorsApi.md#get_autocomplete_authors) | **GET** /autocomplete/authors | /autocomplete/authors\n",
"*AuthorsApi* | [**get_random_author**](docs/AuthorsApi.md#get_random_author) | **GET** /authors/random | Get Random Author\n",
"*AutocompleteApi* | [**get_autocomplete**](docs/AutocompleteApi.md#get_autocomplete) | **GET** /autocomplete | /autocomplete\n",
"*AutocompleteApi* | [**get_autocomplete_authors**](docs/AutocompleteApi.md#get_autocomplete_authors) | **GET** /autocomplete/authors | /autocomplete/authors\n",
"*AutocompleteApi* | [**get_autocomplete_concepts**](docs/AutocompleteApi.md#get_autocomplete_concepts) | **GET** /autocomplete/concepts | /autocomplete/concepts\n",
"*AutocompleteApi* | [**get_autocomplete_funders**](docs/AutocompleteApi.md#get_autocomplete_funders) | **GET** /autocomplete/funders | /autocomplete/funders\n",
"*AutocompleteApi* | [**get_autocomplete_institutions**](docs/AutocompleteApi.md#get_autocomplete_institutions) | **GET** /autocomplete/institutions | /autocomplete/institutions\n",
"*AutocompleteApi* | [**get_autocomplete_publishers**](docs/AutocompleteApi.md#get_autocomplete_publishers) | **GET** /autocomplete/publishers | /autocomplete/publishers\n",
"*AutocompleteApi* | [**get_autocomplete_sources**](docs/AutocompleteApi.md#get_autocomplete_sources) | **GET** /autocomplete/sources | /autocomplete/sources\n",
"*AutocompleteApi* | [**get_autocomplete_works**](docs/AutocompleteApi.md#get_autocomplete_works) | **GET** /autocomplete/works | /autocomplete/works\n",
"*ConceptsApi* | [**get_autocomplete_concepts**](docs/ConceptsApi.md#get_autocomplete_concepts) | **GET** /autocomplete/concepts | /autocomplete/concepts\n",
"*ConceptsApi* | [**get_concept**](docs/ConceptsApi.md#get_concept) | **GET** /concepts/{id} | /concepts/{id}\n",
"*ConceptsApi* | [**get_concepts**](docs/ConceptsApi.md#get_concepts) | **GET** /concepts | /concepts\n",
"*ConceptsApi* | [**get_random_concept**](docs/ConceptsApi.md#get_random_concept) | **GET** /concepts/random | /concepts/random\n",
"*FundersApi* | [**get_autocomplete_funders**](docs/FundersApi.md#get_autocomplete_funders) | **GET** /autocomplete/funders | /autocomplete/funders\n",
"*FundersApi* | [**get_funder**](docs/FundersApi.md#get_funder) | **GET** /funders/{id} | /funders/{id}\n",
"*FundersApi* | [**get_funders**](docs/FundersApi.md#get_funders) | **GET** /funders | /funders\n",
"*FundersApi* | [**get_random_funder**](docs/FundersApi.md#get_random_funder) | **GET** /funders/random | /funders/random\n",
"*InfoApi* | [**get_root**](docs/InfoApi.md#get_root) | **GET** / | Root\n",
"*InstitutionsApi* | [**get_autocomplete_institutions**](docs/InstitutionsApi.md#get_autocomplete_institutions) | **GET** /autocomplete/institutions | /autocomplete/institutions\n",
"*InstitutionsApi* | [**get_institution**](docs/InstitutionsApi.md#get_institution) | **GET** /institutions/{id} | /institutions/{id}\n",
"*InstitutionsApi* | [**get_institutions**](docs/InstitutionsApi.md#get_institutions) | **GET** /institutions | /institutions\n",
"*InstitutionsApi* | [**get_random_institution**](docs/InstitutionsApi.md#get_random_institution) | **GET** /institutions/random | /institutions/random\n",
"*ListApi* | [**get_works**](docs/ListApi.md#get_works) | **GET** /works | /works\n",
"*NgramsApi* | [**get_work_ngrams**](docs/NgramsApi.md#get_work_ngrams) | **GET** /works/{id}/ngrams | /works/{id}/ngrams\n",
"*PeopleApi* | [**get_person**](docs/PeopleApi.md#get_person) | **GET** /people/{id} | /people/{id}\n",
"*PublishersApi* | [**get_autocomplete_publishers**](docs/PublishersApi.md#get_autocomplete_publishers) | **GET** /autocomplete/publishers | /autocomplete/publishers\n",
"*PublishersApi* | [**get_publisher**](docs/PublishersApi.md#get_publisher) | **GET** /publishers/{id} | /publishers/{id}\n",
"*PublishersApi* | [**get_publishers**](docs/PublishersApi.md#get_publishers) | **GET** /publishers | /publishers\n",
"*PublishersApi* | [**get_random_publisher**](docs/PublishersApi.md#get_random_publisher) | **GET** /publishers/random | /publishers/random\n",
"*RandomApi* | [**get_random_author**](docs/RandomApi.md#get_random_author) | **GET** /authors/random | Get Random Author\n",
"*RandomApi* | [**get_random_concept**](docs/RandomApi.md#get_random_concept) | **GET** /concepts/random | /concepts/random\n",
"*RandomApi* | [**get_random_funder**](docs/RandomApi.md#get_random_funder) | **GET** /funders/random | /funders/random\n",
"*RandomApi* | [**get_random_institution**](docs/RandomApi.md#get_random_institution) | **GET** /institutions/random | /institutions/random\n",
"*RandomApi* | [**get_random_publisher**](docs/RandomApi.md#get_random_publisher) | **GET** /publishers/random | /publishers/random\n",
"*RandomApi* | [**get_random_source**](docs/RandomApi.md#get_random_source) | **GET** /sources/random | /sources/random\n",
"*RandomApi* | [**get_random_work**](docs/RandomApi.md#get_random_work) | **GET** /works/random | /works/random\n",
"*SingleApi* | [**get_author**](docs/SingleApi.md#get_author) | **GET** /authors/{id} | Get Author\n",
"*SingleApi* | [**get_concept**](docs/SingleApi.md#get_concept) | **GET** /concepts/{id} | /concepts/{id}\n",
"*SingleApi* | [**get_funder**](docs/SingleApi.md#get_funder) | **GET** /funders/{id} | /funders/{id}\n",
"*SingleApi* | [**get_institution**](docs/SingleApi.md#get_institution) | **GET** /institutions/{id} | /institutions/{id}\n",
"*SingleApi* | [**get_publisher**](docs/SingleApi.md#get_publisher) | **GET** /publishers/{id} | /publishers/{id}\n",
"*SingleApi* | [**get_random_author**](docs/SingleApi.md#get_random_author) | **GET** /authors/random | Get Random Author\n",
"*SingleApi* | [**get_random_concept**](docs/SingleApi.md#get_random_concept) | **GET** /concepts/random | /concepts/random\n",
"*SingleApi* | [**get_random_funder**](docs/SingleApi.md#get_random_funder) | **GET** /funders/random | /funders/random\n",
"*SingleApi* | [**get_random_institution**](docs/SingleApi.md#get_random_institution) | **GET** /institutions/random | /institutions/random\n",
"*SingleApi* | [**get_random_publisher**](docs/SingleApi.md#get_random_publisher) | **GET** /publishers/random | /publishers/random\n",
"*SingleApi* | [**get_random_source**](docs/SingleApi.md#get_random_source) | **GET** /sources/random | /sources/random\n",
"*SingleApi* | [**get_random_work**](docs/SingleApi.md#get_random_work) | **GET** /works/random | /works/random\n",
"*SingleApi* | [**get_source**](docs/SingleApi.md#get_source) | **GET** /sources/{id} | /sources/{id}\n",
"*SingleApi* | [**get_work**](docs/SingleApi.md#get_work) | **GET** /works/{id} | /works/{id}\n",
"*SingleApi* | [**get_work_ngrams**](docs/SingleApi.md#get_work_ngrams) | **GET** /works/{id}/ngrams | /works/{id}/ngrams\n",
"*SourcesApi* | [**get_autocomplete_sources**](docs/SourcesApi.md#get_autocomplete_sources) | **GET** /autocomplete/sources | /autocomplete/sources\n",
"*SourcesApi* | [**get_random_source**](docs/SourcesApi.md#get_random_source) | **GET** /sources/random | /sources/random\n",
"*SourcesApi* | [**get_source**](docs/SourcesApi.md#get_source) | **GET** /sources/{id} | /sources/{id}\n",
"*SourcesApi* | [**get_sources**](docs/SourcesApi.md#get_sources) | **GET** /sources | /sources\n",
"*WorksApi* | [**get_autocomplete_works**](docs/WorksApi.md#get_autocomplete_works) | **GET** /autocomplete/works | /autocomplete/works\n",
"*WorksApi* | [**get_random_work**](docs/WorksApi.md#get_random_work) | **GET** /works/random | /works/random\n",
"*WorksApi* | [**get_work**](docs/WorksApi.md#get_work) | **GET** /works/{id} | /works/{id}\n",
"*WorksApi* | [**get_work_ngrams**](docs/WorksApi.md#get_work_ngrams) | **GET** /works/{id}/ngrams | /works/{id}/ngrams\n",
"*WorksApi* | [**get_works**](docs/WorksApi.md#get_works) | **GET** /works | /works\n",
"\n",
"\n",
"## Documentation For Models\n",
"\n",
" - [Apc](docs/Apc.md)\n",
" - [AssociatedInstitution](docs/AssociatedInstitution.md)\n",
" - [Author](docs/Author.md)\n",
" - [AuthorsResponseSchema](docs/AuthorsResponseSchema.md)\n",
" - [AutoCompleteResultItem](docs/AutoCompleteResultItem.md)\n",
" - [AutoCompleteResultSchema](docs/AutoCompleteResultSchema.md)\n",
" - [BaseSelectionAttributes](docs/BaseSelectionAttributes.md)\n",
" - [Concept](docs/Concept.md)\n",
" - [ConceptIds](docs/ConceptIds.md)\n",
" - [ConceptSchema](docs/ConceptSchema.md)\n",
" - [ConceptsResponseSchema](docs/ConceptsResponseSchema.md)\n",
" - [DehydratedConcept](docs/DehydratedConcept.md)\n",
" - [DehydratedInstitution](docs/DehydratedInstitution.md)\n",
" - [ErrorMessage](docs/ErrorMessage.md)\n",
" - [FunderSchema](docs/FunderSchema.md)\n",
" - [FundersArray](docs/FundersArray.md)\n",
" - [Geo](docs/Geo.md)\n",
" - [Ids](docs/Ids.md)\n",
" - [InstitutionSchema](docs/InstitutionSchema.md)\n",
" - [InstitutionsResponseSchema](docs/InstitutionsResponseSchema.md)\n",
" - [InternationalDescription](docs/InternationalDescription.md)\n",
" - [InternationalDisplayName](docs/InternationalDisplayName.md)\n",
" - [InternationalDisplayNameAndDescription](docs/InternationalDisplayNameAndDescription.md)\n",
" - [Internationalisation](docs/Internationalisation.md)\n",
" - [Location](docs/Location.md)\n",
" - [LocationSource](docs/LocationSource.md)\n",
" - [Meta](docs/Meta.md)\n",
" - [NgramMeta](docs/NgramMeta.md)\n",
" - [PersonResponseSchema](docs/PersonResponseSchema.md)\n",
" - [PublisherSchema](docs/PublisherSchema.md)\n",
" - [PublisherSchemaParentPublisher](docs/PublisherSchemaParentPublisher.md)\n",
" - [PublishersResponseSchema](docs/PublishersResponseSchema.md)\n",
" - [Role](docs/Role.md)\n",
" - [RootResponseSchema](docs/RootResponseSchema.md)\n",
" - [SourceSchema](docs/SourceSchema.md)\n",
" - [SourcesArray](docs/SourcesArray.md)\n",
" - [SummaryStats](docs/SummaryStats.md)\n",
" - [WorkAttributes](docs/WorkAttributes.md)\n",
" - [WorkNgramsSchema](docs/WorkNgramsSchema.md)\n",
" - [WorkSchema](docs/WorkSchema.md)\n",
" - [WorkSchemaBiblio](docs/WorkSchemaBiblio.md)\n",
" - [WorkSchemaCitedByPercentileYear](docs/WorkSchemaCitedByPercentileYear.md)\n",
" - [WorkSchemaOpenAccess](docs/WorkSchemaOpenAccess.md)\n",
" - [WorksResponseSchema](docs/WorksResponseSchema.md)\n",
"\n",
"\n",
"\n",
"## Documentation For Authorization\n",
"\n",
"Endpoints do not require authorization.\n",
"\n",
"\n",
"## Author\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}