Skip to main content

Python API for the NovelAI REST API

Project description

novelai-api

Python API for the NovelAI REST API

This module is intended to be used by developers as a helper for using NovelAI's REST API.

Category Badges
Pypi PyPI PyPI - Python Version PyPI - License PyPI - Format
Quality checking Python package Python package linting: pylint security: bandit Code style: black
Stats GitHub top language Libraries.io dependency status for GitHub repo GitHub repo size GitHub issues GitHub pull requests
Activity GitHub last commit GitHub commits since tagged version GitHub commit activity

Prerequisites

Before anything, ensure that nox is installed (pip install nox). For logging in, credentials are needed (NAI_USERNAME and NAI_PASSWORD). They should be passed via the environment variables (dotenv file supported).

Examples

The examples are in the example folder. Each example is standalone and can be used as a test. Examples should be ran with nox -s run -- python example/<name>.py.

Some tests can act as example. The full list is as follows :

  • decryption and re-encryption: tests/test_decrypt_encrypt_integrity_check.py
  • diverse generations: tests/test_generate.py
  • parallel generations: tests/test_generate_parallel.py

Usage

The source and all the required functions are located in the novelai-api folder. The examples and tests showcase how this API should be used and can be regarded as the "right way" to use it. However, it doesn't mean one can't use the "low level" part, which is a thin implementation of the REST endpoints, while the "high level" part is an abstraction built on that low level.

Contributing

You can contribute features and enhancements through PR. Any PR should pass the tests and the pre-commits before submission.

The tests against the API can be ran with nox -s test_api. Note that having node.js installed is required for the test to run properly. /!\ WIP /!\ The tests against the mocked backend can be ran with nox -s test_mock.

To install and run the pre-commit hook, run nox -s pre-commit. This hook should be installed before committing anything.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

novelai_api-0.10.4.tar.gz (3.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

novelai_api-0.10.4-py3-none-any.whl (3.1 MB view details)

Uploaded Python 3

File details

Details for the file novelai_api-0.10.4.tar.gz.

File metadata

  • Download URL: novelai_api-0.10.4.tar.gz
  • Upload date:
  • Size: 3.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.9 Linux/5.15.89-1-MANJARO

File hashes

Hashes for novelai_api-0.10.4.tar.gz
Algorithm Hash digest
SHA256 ce0c20594564b70b65bd713afaecd5f952b1b15a51ba4d4a3989e8833ca6e5a5
MD5 c70dd4f09d1c149531a9a7d23a22c4cc
BLAKE2b-256 2dd3da3c7e6d8ae66c8e4d54eb199cd0a8129081a9c8d6bdb2f48fb3dcbe1bdb

See more details on using hashes here.

File details

Details for the file novelai_api-0.10.4-py3-none-any.whl.

File metadata

  • Download URL: novelai_api-0.10.4-py3-none-any.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.9 Linux/5.15.89-1-MANJARO

File hashes

Hashes for novelai_api-0.10.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f01e5e5853a82608e2fbbbf06e140651d3e745f5b0a25f64731e547d412a6fdc
MD5 a1e09ff1e411d035c3cb54a4506e76c6
BLAKE2b-256 05ceaca37cad22e957be834cb8dd3592530e4355427675fcb0810a637dc7c75f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page