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.3.tar.gz (2.2 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.3-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: anysolver_api-0.1.3.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for anysolver_api-0.1.3.tar.gz
Algorithm Hash digest
SHA256 7ecf34f3721bdf54299ae35e6bcba7e150248f6a1fbac40317c901279f5b12fa
MD5 a3c1ed75e73efde10835d988e34dc815
BLAKE2b-256 72482f5099211b587354724f45c6cbbcf8ceeb2d16c93bd60728a720ec13838a

See more details on using hashes here.

Provenance

The following attestation bundles were made for anysolver_api-0.1.3.tar.gz:

Publisher: release.yml on flafkus/anysolver-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: anysolver_api-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for anysolver_api-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6f15c55a30664674bb4e63424e220877400f85293c3e7d2e444eeb0d0262667b
MD5 8f954c0b4fe79fdb528b8300785516e1
BLAKE2b-256 0bf552296206b35d4d943fa09b4397d8ed49677d15541843ae1aa873f77bf820

See more details on using hashes here.

Provenance

The following attestation bundles were made for anysolver_api-0.1.3-py3-none-any.whl:

Publisher: release.yml on flafkus/anysolver-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

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