Skip to content

Mearman/openalex-python

Repository files navigation

OpenAlex API

OpenAlex is a fully open catalog of the global research system.

It's named after the ancient Library of Alexandria and made by the nonprofit OurResearch.

OpenAPI Specification

Mearman/openalex-api-spec

This OpenAPI specification is reverse-engineered and derived from spec generated by openapi-devtools.

The specification document itself is OpenAPI version 3.1 and is generated from TypeScript source code.

Open in

Releases

Clients

TypeScript

TypeScript Fetch

TypeScript Node

Python Open in Open in


This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 0.3.0
  • Package version: 0.1.0
  • Generator version: 7.7.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 3.7+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/Mearman/openalex-python.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/Mearman/openalex-python.git)

Then import the package:

import openalex_api

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import openalex_api

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import openalex_api
from openalex_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.openalex.org
# See configuration.py for a list of all supported configuration parameters.
configuration = openalex_api.Configuration(
    host = "https://api.openalex.org"
)



# Enter a context with an instance of the API client
with openalex_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = openalex_api.OpenAlexApi(api_client)
    id = 'id_example' # str | 
    select = 'select_example' # str |  (optional)
    user_agent = 'user_agent_example' # str | [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)
    mailto = 'mailto_example' # str | 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:[email protected]`, or in the User-Agent request header, like `User-Agent: my-app (mailto:[email protected])`. 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)

    try:
        # Get Author
        api_response = api_instance.get_author(id, select=select, user_agent=user_agent, mailto=mailto)
        print("The response of OpenAlexApi->get_author:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling OpenAlexApi->get_author: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.openalex.org

Class Method HTTP request Description
OpenAlexApi get_author GET /authors/{id} Get Author
OpenAlexApi get_authors GET /authors List Authors
OpenAlexApi get_autocomplete GET /autocomplete /autocomplete
OpenAlexApi get_autocomplete_authors GET /autocomplete/authors /autocomplete/authors
OpenAlexApi get_autocomplete_concepts GET /autocomplete/concepts /autocomplete/concepts
OpenAlexApi get_autocomplete_funders GET /autocomplete/funders /autocomplete/funders
OpenAlexApi get_autocomplete_institutions GET /autocomplete/institutions /autocomplete/institutions
OpenAlexApi get_autocomplete_publishers GET /autocomplete/publishers /autocomplete/publishers
OpenAlexApi get_autocomplete_sources GET /autocomplete/sources /autocomplete/sources
OpenAlexApi get_autocomplete_works GET /autocomplete/works /autocomplete/works
OpenAlexApi get_concept_by_id GET /concepts/{id} /concepts/{id}
OpenAlexApi get_concepts GET /concepts /concepts
OpenAlexApi get_domain_by_id GET /domains/{id} /domains/{id}
OpenAlexApi get_field_by_id GET /field/{id} /fields/{id}
OpenAlexApi get_funder GET /funders/{id} /funders/{id}
OpenAlexApi get_funders GET /funders /funders
OpenAlexApi get_institution GET /institutions/{id} /institutions/{id}
OpenAlexApi get_institutions GET /institutions /institutions
OpenAlexApi get_person GET /people/{id} /people/{id}
OpenAlexApi get_publisher GET /publishers/{id} /publishers/{id}
OpenAlexApi get_publishers GET /publishers /publishers
OpenAlexApi get_random_author GET /authors/random Get Random Author
OpenAlexApi get_random_concept GET /concepts/random /concepts/random
OpenAlexApi get_random_funder GET /funders/random /funders/random
OpenAlexApi get_random_institution GET /institutions/random /institutions/random
OpenAlexApi get_random_publisher GET /publishers/random /publishers/random
OpenAlexApi get_random_source GET /sources/random /sources/random
OpenAlexApi get_random_work GET /works/random /works/random
OpenAlexApi get_root GET / Root
OpenAlexApi get_source GET /sources/{id} /sources/{id}
OpenAlexApi get_sources GET /sources /sources
OpenAlexApi get_subfield_by_id GET /subfields/{id} /subfields/{id}
OpenAlexApi get_topic_by_id GET /topics/{id} /topics/{id}
OpenAlexApi get_topics GET /topics /topics
OpenAlexApi get_work GET /works/{id} /works/{id}
OpenAlexApi get_work_ngrams GET /works/{id}/ngrams /works/{id}/ngrams
OpenAlexApi get_works GET /works /works

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages