Skip to main content

No project description provided

Project description

Mixpeek Python Library

fern shield

The Mixpeek Python Library provides convenient access to the Mixpeek API from applications written in Python.

Installation

Add this dependency to your project's build file:

pip install mixpeek
# or
poetry add mixpeek

Usage

Simply import Mixpeek and start making calls to our API.

from mixpeek.client import Mixpeek

client = Mixpeek(
    api_key="..."
)

Async Client

The SDK also exports an async client so that you can make non-blocking calls to our API.

from mixpeek.client import AsymcMixpeek

client = AsyncMixpeek(
    api_key="..."
)

Exception Handling

All errors thrown by the SDK will be subclasses of ApiError.

import mixpeek

try:
  client.search(...)
except mixpeek.core.ApiError as e: # Handle all errors
  print(e.status_code)
  print(e.body)

Advanced

Retries

The Mixpeek SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long as the request is deemed retriable and the number of retry attempts has not grown larger than the configured retry limit.

A request is deemed retriable when any of the following HTTP status codes is returned:

  • 408 (Timeout)
  • 409 (Conflict)
  • 429 (Too Many Requests)
  • 5XX (Internal Server Errors)

Use the max_retries request option to configure this behavior.

from mixpeek.client import Mixpeek

client = Mixpeek(...)

# Override retries for a specific method
client.search(..., {
    max_retries=5
})

Timeouts

By default, requests time out after 60 seconds. You can configure this with a timeout option at the client or request level.

from mixpeek.client import Mixpeek

client = Mixpeek(
    # All timeouts are 20 seconds
    timeout=20.0,
)

# Override timeout for a specific method
client.search(..., {
    timeout_in_seconds=20.0
})

Custom HTTP client

You can override the httpx client to customize it for your use-case. Some common use-cases include support for proxies and transports.

import httpx

from mixpeek.client import Mixpeek

client = Mixpeek(
    http_client=httpx.Client(
        proxies="http://my.test.proxy.example.com",
        transport=httpx.HTTPTransport(local_address="0.0.0.0"),
    ),
)

Beta Status

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version. This way, you can install the same version each time without breaking changes.

Contributing

While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!

Project details


Release history Release notifications | RSS feed

This version

0.6.2

Download files

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

Source Distribution

mixpeek-0.6.2.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

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

mixpeek-0.6.2-py3-none-any.whl (52.3 kB view details)

Uploaded Python 3

File details

Details for the file mixpeek-0.6.2.tar.gz.

File metadata

  • Download URL: mixpeek-0.6.2.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.8.18 Linux/5.15.0-1059-azure

File hashes

Hashes for mixpeek-0.6.2.tar.gz
Algorithm Hash digest
SHA256 5547f2066c384b4a45dda54308b58f12d68d65e82973b952971828fe7be8d46d
MD5 758e5509f513971eaca048a8179c63af
BLAKE2b-256 0023af13d92bba4f3223fb07a6a05840b4a3e7857d43735612c7cdfd4572a798

See more details on using hashes here.

File details

Details for the file mixpeek-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: mixpeek-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 52.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.8.18 Linux/5.15.0-1059-azure

File hashes

Hashes for mixpeek-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a91c44a8e52e4d62cfcce31e92736d2808eacde89277a845e83186a9db810207
MD5 a5e18c9c4c69f22e0e6ce6c13305b543
BLAKE2b-256 21d3a089023622e49db0269142b41d2a7f22abe3b75dde5c343ad6ae6c5d1404

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