Skip to main content

Async HTTP client for AssistAgro API

Project description

AssistAgro API Client

Асинхронный HTTP-клиент для AssistAgro API.

Установка

pip install assistagro-client

Использование

import asyncio
from assistagro_client import AssistAgroClient

async def main():
    async with AssistAgroClient(base_url="https://gateway-frontend.agroassist.ru") as client:
        tokens = await client.auth.sign_in(
            email="user@example.com",
            password="password123"
        )
        print(f"Access token: {tokens.access_token[:20]}...")

        structures = await client.structures.list_()
        structure_guid = structures[0].structure_guid

        season = await client.seasons.get_current()

        fields = await client.fields.list_(
            structure_guids=[structure_guid],
            season_id=season.season_id,
        )
        print(f"Найдено полей: {len(fields)}")

        crops_response = await client.dictionaries.get_crops()
        print(f"Культур: {len(crops_response.crops)}")

        tasks = await client.tasks.list_(structure_guid=structure_guid)
        print(f"Найдено задач: {len(tasks)}")

if __name__ == "__main__":
    asyncio.run(main())

API эндпоинты

Модуль Описание Основные методы
auth Аутентификация sign_in, refresh_tokens, logout
accounts Пользователи get_current_user, get_users
companies Компании list_(), list_all, get, get_license, get_license_metadata, get_activities, get_dashboards
structures Структуры list_(), list_plain
seasons Сезоны list, get_current, get_by_name, get_season_id_by_name
fields Поля list_(), get_contours, get_phenophases, get_monitoring, list_meta
tasks Задачи list_(), create, get_list_meta
reports Отчёты list_(), create, get_metadata, get_problems, get_list_meta
techmaps Технологические карты list_(), create
meteostations Метеостанции list_(), get, get_by_field, get_manufacturers, get_providers, get_sensors, get_coordinates_history, get_history
dictionaries Справочники get_crops, get_crop_products, get_techoperations, get_pesticides, get_fertilizers, get_machines, get_tools, get_units, get_regions, get_countries, и др.

Примеры

Скопируйте .env.example в .env и заполните переменные:

cp .env.example .env
ASSISTAGRO_EMAIL=user@example.com
ASSISTAGRO_PASSWORD=your-password
ASSISTAGRO_BASE_URL=https://gateway-frontend.agroassist.ru
ASSISTAGRO_DEBUG=false

Запуск примеров:

# Запустить все модули
uv run python examples/run_tests.py

# Запустить конкретный модуль
uv run python examples/run_tests.py --module structures
uv run python examples/run_tests.py -m auth

# Доступные модули:
# auth, structures, companies, current_user, users,
# dictionaries, meteostations, tasks, fields, reports, techmaps, seasons

Разработка

# Установить зависимости
uv sync

# Запустить тесты
uv run pytest

# Запустить линтер
uv run ruff check .
uv run ruff check --fix .

# Проверка типов
uv run mypy src/

# Форматирование
uv run black .

Лицензия

MIT

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

assistagroapi-0.3.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

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

assistagroapi-0.3.0-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file assistagroapi-0.3.0.tar.gz.

File metadata

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

File hashes

Hashes for assistagroapi-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8da3a742a6cf357f03d2305ceff782f650b0fa760759383dbb1e97af8299ed85
MD5 a75c0bfa33098c8e256f106cf5c1b1dd
BLAKE2b-256 0518f98c7274e672e604e62c2cf99014c4877e19a7d800d3203cc4420175fd80

See more details on using hashes here.

File details

Details for the file assistagroapi-0.3.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for assistagroapi-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad1f8d3034b78726a19f0d5a1b54dc9cf01c661057198ab941e0b6e1db329773
MD5 9291abb9cc2b2974da09d6319928f16e
BLAKE2b-256 63e4a80855886d23fdfc991d979d9e0110a0061b4c034ae416b0ecca123648e2

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