Skip to main content

Python Wrapper for AnySolver

Unofficial API wrapper for the AnySolver service.

Requirements

  • Python 3.12

Installation

pip install anysolver-api

or

uv add anysolver-api

Usage

from anysolver_api import AnySolver

solver = AnySolver("API_KEY")

balance = solver.getBalance()
print(f"Balance: ${balance}")

result = solver.solve(
    {
        "type": "TaskType",
        "websiteKey": "KEY",
        "websiteURL": "https://someurl.com/"
    }
)['token']

For extra fields, use the documentation for the specific task on the AnySolver API.

You can also provide extra settings, e.g. for routing through specific models / auto route settings:

result = solver.solve(
    task = {
        "type": "TaskType",
        "websiteKey": "KEY",
        "websiteURL": "https://someurl.com/"
    },
    settings = {
        "routing": { "mode": "autoCheapest" }
    },
    timeout = 120, # how long to wait for solution
    delay = 5 # time between checks
)['token']

Error handling

All API errors raise one of the following:

from anysolver_api.exceptions import AnySolverExternalError, AnySolverInternalError, AnySolverTimeoutError

try:
    result = solver.solve({...})
except AnySolverExternalError as e:
    # invalid input, bad task, etc.
    ...
except AnySolverInternalError as e:
    # error on AnySolver's side
    ...
except AnySolverTimeoutError as e:
    # task didn't finish in time
    ...

Download files

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

Source Distribution

anysolver_api-0.1.2.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

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

anysolver_api-0.1.2-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file anysolver_api-0.1.2.tar.gz.

File metadata

  • Download URL: anysolver_api-0.1.2.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for anysolver_api-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d5c9cb2862305ca5070861e5991fb0a9100a5b15acc072f26cc3fba11564c1d4
MD5 07dcaab745e2a38d0a58173fe2f17d7a
BLAKE2b-256 e465cf7cbf574511b9ad429601a2afb9f70d3aac23fdeaf45b15048e5458ede7

See more details on using hashes here.

File details

Details for the file anysolver_api-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: anysolver_api-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for anysolver_api-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 71202fb31f353f2fab1c6e58d724f92a238dbf9ef029194d2181f2be4bd1b05a
MD5 05d605af74e27e6507766e4d7c05f316
BLAKE2b-256 8b7557a4e5d8d43c1863c8aab24011e894b9478c7dffd7a45f5dbd412f0434a4

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.3

2 files

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page