Skip to main content

This is an UNOFFICIAL Python API client for Contabo

Project description

pfruck_contabo

⚠️ I am not affiliated in any way with Contabo

This is an UNOFFICIAL Python API client for contabo.com, which is a hosting provider for VPS and dedicated servers.

The goal of this client is to make management of your server instances more easy using a native Python API for the Contabo API. This Python package is automatically generated by the OpenAPI Generator project.

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

The simplest way to install the Contabo API client is by using the provided pip package:

pip install pfruck-contabo

You can also install the package directly from the GitHub Repo using pip:

pip install git+https://github.com/p-fruck/python-contabo.git

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

Then import the package:

import pfruck_contabo

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 pfruck_contabo

Getting Started

Please follow the installation procedure and then run the following:

import time
import pfruck_contabo
from pprint import pprint
from pfruck_contabo.api import customer_api
from pfruck_contabo.model.find_customer_response import FindCustomerResponse
from pfruck_contabo.model.list_payment_method_response import ListPaymentMethodResponse
# Defining the host is optional and defaults to https://api.contabo.com
# See configuration.py for a list of all supported configuration parameters.
configuration = pfruck_contabo.Configuration(
    host = "https://api.contabo.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (JWT): bearer
configuration = pfruck_contabo.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)


# Enter a context with an instance of the API client
with pfruck_contabo.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = customer_api.CustomerApi(api_client)
    x_request_id = "04e0f898-37b4-48bc-a794-1a57abe6aa31" # str | [Uuid4](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)) to identify individual requests for support cases. You can use [uuidgenerator](https://www.uuidgenerator.net/version4) to generate them manually.
    x_trace_id = "x-trace-id_example" # str | Identifier to trace group of requests. (optional)

    try:
        # Get customer info
        api_response = api_instance.retrieve_customer(x_request_id, x_trace_id=x_trace_id)
        pprint(api_response)
    except pfruck_contabo.ApiException as e:
        print("Exception when calling CustomerApi->retrieve_customer: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.contabo.com

Class Method HTTP request Description
CustomerApi retrieve_customer GET /v1/customer Get customer info
CustomerApi retrieve_payment_method GET /v1/customer/payment-method List current payment method
FirewallsApi assign_instance_firewall POST /v1/firewalls/{firewallId}/instances/{instanceId} Add instance to a firewall
FirewallsApi create_firewall POST /v1/firewalls Create a new firewall definition
FirewallsApi delete_firewall DELETE /v1/firewalls/{firewallId} Delete existing firewall by id
FirewallsApi patch_firewall PATCH /v1/firewalls/{firewallId} Update a firewall by id
FirewallsApi put_firewall PUT /v1/firewalls/{firewallId} Update specific firewall rules
FirewallsApi retrieve_firewall GET /v1/firewalls/{firewallId} Get specific firewall by its id
FirewallsApi retrieve_firewall_list GET /v1/firewalls List all firewalls
FirewallsApi set_default_firewall PUT /v1/firewalls/{firewallId}/default Set specific firewall to be default
FirewallsApi unassign_instance_firewall DELETE /v1/firewalls/{firewallId}/instances/{instanceId} Remove instance from a firewall
FirewallsAuditsApi retrieve_firewall_audits_list GET /v1/firewalls/audits List history about your Firewalls (audit)
ImagesApi create_custom_image POST /v1/compute/images Provide a custom image
ImagesApi delete_image DELETE /v1/compute/images/{imageId} Delete an uploaded custom image by its id
ImagesApi retrieve_custom_images_stats GET /v1/compute/images/stats List statistics regarding the customer's custom images
ImagesApi retrieve_image GET /v1/compute/images/{imageId} Get details about a specific image by its id
ImagesApi retrieve_image_list GET /v1/compute/images List available standard and custom images
ImagesApi update_image PATCH /v1/compute/images/{imageId} Update custom image name by its id
ImagesAuditsApi retrieve_image_audits_list GET /v1/compute/images/audits List history about your custom images (audit)
InstanceActionsApi restart POST /v1/compute/instances/{instanceId}/actions/restart Restart a compute instance / resource identified by its id
InstanceActionsApi shutdown POST /v1/compute/instances/{instanceId}/actions/shutdown Shutdown compute instance / resource by its id
InstanceActionsApi start POST /v1/compute/instances/{instanceId}/actions/start Start a compute instance / resource identified by its id
InstanceActionsApi stop POST /v1/compute/instances/{instanceId}/actions/stop Stop compute instance / resource by its id
InstanceActionsAuditsApi retrieve_instances_actions_audits_list GET /v1/compute/instances/actions/audits List history about your actions (audit) triggered via the API
InstancesApi cancel_instance POST /v1/compute/instances/{instanceId}/cancel Cancel specific instance by id
InstancesApi create_instance POST /v1/compute/instances Create a new instance
InstancesApi patch_instance PATCH /v1/compute/instances/{instanceId} Update specific instance
InstancesApi reinstall_instance PUT /v1/compute/instances/{instanceId} Reinstall specific instance
InstancesApi retrieve_instance GET /v1/compute/instances/{instanceId} Get specific instance by id
InstancesApi retrieve_instances_list GET /v1/compute/instances List instances
InstancesApi upgrade_instance POST /v1/compute/instances/{instanceId}/upgrade Upgrading instance capabilities
InstancesAuditsApi retrieve_instances_audits_list GET /v1/compute/instances/audits List history about your instances (audit) triggered via the API
InternalApi create_ticket POST /v1/create-ticket Create a new support ticket
InternalApi retrieve_user_is_password_set GET /v1/users/is-password-set Get user is password set status
InvoicesApi get_file GET /v1/invoices/{invoiceId} Download invoice
InvoicesApi retrieve_invoice_number_list GET /v1/invoices List invoices
LedgerApi retrieve_ledger_entries_list GET /v1/ledger/ledger-entries List ledger entries
ObjectStoragesApi cancel_object_storage PATCH /v1/object-storages/{objectStorageId}/cancel Cancels the specified object storage at the next possible date
ObjectStoragesApi create_object_storage POST /v1/object-storages Create a new object storage
ObjectStoragesApi retrieve_data_center_list GET /v1/data-centers List data centers
ObjectStoragesApi retrieve_object_storage GET /v1/object-storages/{objectStorageId} Get specific object storage by its id
ObjectStoragesApi retrieve_object_storage_list GET /v1/object-storages List all your Object Storages
ObjectStoragesApi retrieve_object_storages_stats GET /v1/object-storages/{objectStorageId}/stats List usage statistics about the specified object storage
ObjectStoragesApi upgrade_object_storage POST /v1/object-storages/{objectStorageId}/resize Upgrade object storage size resp. update autoscaling settings.
ObjectStoragesAuditsApi retrieve_object_storage_audits_list GET /v1/object-storages/audits List history about your object storages (audit)
PaymentMethodsApi retrieve_payment_method_list GET /v1/payment-methods List payment methods
PresetRulesApi retrieve_preset_rules GET /v1/firewalls/preset-rules Get all preset rules
PrivateNetworksApi assign_instance_private_network POST /v1/private-networks/{privateNetworkId}/instances/{instanceId} Add instance to a Private Network
PrivateNetworksApi create_private_network POST /v1/private-networks Create a new Private Network
PrivateNetworksApi delete_private_network DELETE /v1/private-networks/{privateNetworkId} Delete existing Private Network by id
PrivateNetworksApi patch_private_network PATCH /v1/private-networks/{privateNetworkId} Update a Private Network by id
PrivateNetworksApi retrieve_private_network GET /v1/private-networks/{privateNetworkId} Get specific Private Network by id
PrivateNetworksApi retrieve_private_network_list GET /v1/private-networks List Private Networks
PrivateNetworksApi unassign_instance_private_network DELETE /v1/private-networks/{privateNetworkId}/instances/{instanceId} Remove instance from a Private Network
PrivateNetworksAuditsApi retrieve_private_network_audits_list GET /v1/private-networks/audits List history about your Private Networks (audit)
RolesApi create_role POST /v1/roles Create a new role
RolesApi delete_role DELETE /v1/roles/{roleId} Delete existing role by id
RolesApi retrieve_api_permissions_list GET /v1/roles/api-permissions List of API permissions
RolesApi retrieve_role GET /v1/roles/{roleId} Get specific role by id
RolesApi retrieve_role_list GET /v1/roles List roles
RolesApi update_role PUT /v1/roles/{roleId} Update specific role by id
RolesAuditsApi retrieve_role_audits_list GET /v1/roles/audits List history about your roles (audit)
SecretsApi create_secret POST /v1/secrets Create a new secret
SecretsApi delete_secret DELETE /v1/secrets/{secretId} Delete existing secret by id
SecretsApi retrieve_secret GET /v1/secrets/{secretId} Get specific secret by id
SecretsApi retrieve_secret_list GET /v1/secrets List secrets
SecretsApi update_secret PATCH /v1/secrets/{secretId} Update specific secret by id
SecretsAuditsApi retrieve_secret_audits_list GET /v1/secrets/audits List history about your secrets (audit)
SnapshotsApi create_snapshot POST /v1/compute/instances/{instanceId}/snapshots Create a new instance snapshot
SnapshotsApi delete_snapshot DELETE /v1/compute/instances/{instanceId}/snapshots/{snapshotId} Delete existing snapshot by id
SnapshotsApi retrieve_snapshot GET /v1/compute/instances/{instanceId}/snapshots/{snapshotId} Retrieve a specific snapshot by id
SnapshotsApi retrieve_snapshot_list GET /v1/compute/instances/{instanceId}/snapshots List snapshots
SnapshotsApi rollback_snapshot POST /v1/compute/instances/{instanceId}/snapshots/{snapshotId}/rollback Rollback the instance to a specific snapshot by id
SnapshotsApi update_snapshot PATCH /v1/compute/instances/{instanceId}/snapshots/{snapshotId} Update specific snapshot by id
SnapshotsAuditsApi retrieve_snapshots_audits_list GET /v1/compute/snapshots/audits List history about your snapshots (audit) triggered via the API
TagAssignmentsApi create_assignment POST /v1/tags/{tagId}/assignments/{resourceType}/{resourceId} Create a new assignment for the tag
TagAssignmentsApi delete_assignment DELETE /v1/tags/{tagId}/assignments/{resourceType}/{resourceId} Delete existing tag assignment
TagAssignmentsApi retrieve_assignment GET /v1/tags/{tagId}/assignments/{resourceType}/{resourceId} Get specific assignment for the tag
TagAssignmentsApi retrieve_assignment_list GET /v1/tags/{tagId}/assignments List tag assignments
TagAssignmentsAuditsApi retrieve_assignments_audits_list GET /v1/tags/assignments/audits List history about your assignments (audit)
TagsApi create_tag POST /v1/tags Create a new tag
TagsApi delete_tag DELETE /v1/tags/{tagId} Delete existing tag by id
TagsApi retrieve_tag GET /v1/tags/{tagId} Get specific tag by id
TagsApi retrieve_tag_list GET /v1/tags List tags
TagsApi update_tag PATCH /v1/tags/{tagId} Update specific tag by id
TagsAuditsApi retrieve_tag_audits_list GET /v1/tags/audits List history about your tags (audit)
UsersApi create_user POST /v1/users Create a new user
UsersApi delete_user DELETE /v1/users/{userId} Delete existing user by id
UsersApi generate_client_secret PUT /v1/users/client/secret Generate new client secret
UsersApi get_object_storage_credentials GET /v1/users/{userId}/object-storages/credentials Get S3 compatible object storage credentials
UsersApi regenerate_credentials PATCH /v1/users/{userId}/object-storages/credentials Regenerates secret key of specified user for the S3 compatible object storages
UsersApi resend_email_verification POST /v1/users/{userId}/resend-email-verification Resend email verification
UsersApi reset_password POST /v1/users/{userId}/reset-password Send reset password email
UsersApi retrieve_user GET /v1/users/{userId} Get specific user by id
UsersApi retrieve_user_client GET /v1/users/client Get client
UsersApi retrieve_user_list GET /v1/users List users
UsersApi update_user PATCH /v1/users/{userId} Update specific user by id
UsersAuditsApi retrieve_user_audits_list GET /v1/users/audits List history about your users (audit)
VIPApi assign_ip POST /v1/vips/{ip}/instances/{instanceId} Assign a VIP to a VPS/VDS
VIPApi retrieve_vip GET /v1/vips/{ip} Get specific VIP by ip
VIPApi retrieve_vip_list GET /v1/vips List VIPs
VIPApi unassign_ip DELETE /v1/vips/{ip}/instances/{instanceId} Unassign a VIP from a VPS/VDS
ZeropsApi retrieve_zerops_user GET /v1/zerops/user get zerops user
ZeropsApi sign_in_zerops GET /v1/zerops/sign-in authenticate to zerops

Documentation For Models

Documentation For Authorization

bearer

  • Type: Bearer authentication (JWT)

Author

support@contabo.com

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in pfruck_contabo.apis and pfruck_contabo.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from pfruck_contabo.api.default_api import DefaultApi
  • from pfruck_contabo.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import pfruck_contabo
from pfruck_contabo.apis import *
from pfruck_contabo.models import *

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

pfruck_contabo-1.10.0.tar.gz (251.1 kB view hashes)

Uploaded Source

Built Distribution

pfruck_contabo-1.10.0-py3-none-any.whl (952.7 kB view hashes)

Uploaded Python 3

Supported by

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