The official python SDK for Linode API v4
Project description
linode_api4
The official python library for the Linode API v4 in python.
This library is currently in beta.
Installation
pip install linode_api4
Building from Source
To build and install this package:
Clone this repository
./setup.py install
Usage
Check out the Getting Started guide to start using this library, or read the docs for extensive documentation.
Examples
See the Install on a Linode example project for a simple use case demonstrating many of the features of this library.
Contributing
Tests
Tests live in the tests directory. When invoking tests, make sure you are in the root directory of this project. To run the full suite across all supported python versions, use tox:
tox
Running tox also runs pylint and coverage reports.
The test suite uses fixtures stored as JSON in test/fixtures. These files contain sanitized JSON responses from the API - the file name is the URL called to produce the response, replacing any slashes with underscores.
Test classes should extend test.base.ClientBaseCase. This provides them with self.client, a LinodeClient object that is set up to work with tests. Importantly, any GET request made by this object will be mocked to retrieve data from the test fixtures. This includes lazy-loaded objects using this client (and by extension related models).
When testing against requests other than GET requests, self.mock_post (and equivalent methods for other HTTP verbs) can be used in a with block to mock out the intended request type. These functions accept the relative path from the api base url that should be returned, for example:
# this should return the result of GET /linode/instances/123 with self.mock_post('/linode/instances/123'): linode = self.client.linode.instance_create('g6-standard-2', 'us-east') self.assertEqual(linode.id, 123) # passes
Documentation
This library is documented with Sphinx. Docs live in the docs directory. The easiest way to build the docs is to run sphinx-autobuild in that folder.
Classes and functions inside the library should be annotated with sphinx-compliant docstrings which will be used to automatically generate documentation for the library. When contributing, be sure to update documentation or include new docstrings where applicable to keep the library’s documentation up to date and useful.
Missing or inaccurate documentation is a bug. If you notice that the documentation for this library is out of date or unclear, please open an issue to make us aware of the problem.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for linode_api4-2.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5598da4ebe646c38064f95a5066a3e3e7198ac384afb8256ca3e7fc23eb7576 |
|
MD5 | e23ecd66fd22e89d52fa592421ebc285 |
|
BLAKE2b-256 | 65ed33f2ecccae36b97f2c69fe2cbbd4820473023c587b1c0d881f83de50efc4 |