Skip to main content

Revolution Next (*.revolutionnext.com.au) report downloads via REST API

Project description

revnext

Download Revolution Next (*.revolutionnext.com.au) reports (Parts Price List, Parts by Bin Location) via REST API. Uses auto-login and saves the session to disk so the next run reuses it; if the session is invalid, it logs in again automatically.

  • Install: pip install revnext
  • Editable (from repo root): pip install -e ./packages/revnext

Configuration (.env)

Put your tenant, username, and password in a .env file (e.g. in the project root or cwd). Optional: use python-dotenv so RevNextConfig.from_env() loads it.

Variable Required Description
REVNEXT_TENANT One of tenant/URL Subdomain only (e.g. mikecarneyhttps://mikecarney.revolutionnext.com.au)
REVOLUTIONNEXT_URL One of tenant/URL Full base URL (overrides tenant if both set)
REVNEXT_USERNAME Yes RevNext login User ID
REVNEXT_PASSWORD Yes RevNext login Password
REVNEXT_SESSION_PATH No Where to save/load session cookies (default: .revnext-session.json in cwd)

Example .env:

REVNEXT_TENANT=yourtenant
REVNEXT_USERNAME=your_user_id
REVNEXT_PASSWORD=your_password

The first run logs in via the web form (CSRF + j_spring_security_check) and saves the session to REVNEXT_SESSION_PATH or .revnext-session.json. Later runs load that file, check that the session is still valid, and only re-login if it has expired.

Quick start

from pathlib import Path
from revnext import download_parts_by_bin_report, download_parts_price_list_report

# Config from env (.env or REVNEXT_* / REVOLUTIONNEXT_*)
path1 = download_parts_by_bin_report(
    output_path=Path("C:/Reports/parts_by_bin.csv"),
)
path2 = download_parts_price_list_report(
    output_path=Path("C:/Reports/parts_price_list.csv"),
)

Download one report with explicit config

from pathlib import Path
from revnext import RevNextConfig, download_parts_by_bin_report, download_parts_price_list_report

config = RevNextConfig.from_env()  # or RevNextConfig( base_url="...", username="...", password="...", session_path=... )

path1 = download_parts_by_bin_report(
    config=config,
    output_path=Path("C:/Reports/parts_by_bin.csv"),
)
path2 = download_parts_price_list_report(
    config=config,
    output_path=Path("C:/Reports/parts_price_list.csv"),
)

Example: download both reports (implement in your project)

from pathlib import Path
from typing import Optional

from revnext import RevNextConfig, download_parts_by_bin_report, download_parts_price_list_report


def download_all_reports(
    config: Optional[RevNextConfig] = None,
    output_dir: Optional[Path | str] = None,
) -> list[Path]:
    """Run both reports and save CSVs. Returns the list of paths where files were saved."""
    config = config or RevNextConfig.from_env()
    output_dir = Path(output_dir) if output_dir is not None else Path.cwd()
    path1 = download_parts_by_bin_report(
        config=config,
        output_path=output_dir / "Parts_By_Bin_Location.csv",
    )
    path2 = download_parts_price_list_report(
        config=config,
        output_path=output_dir / "Parts_Price_List.csv",
    )
    return [path1, path2]

Example: download both reports in parallel

from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import Optional

from revnext import RevNextConfig, download_parts_by_bin_report, download_parts_price_list_report


def download_all_reports_parallel(
    config: Optional[RevNextConfig] = None,
    output_dir: Optional[Path | str] = None,
) -> list[Path]:
    """Run both reports in parallel. Returns the list of paths where files were saved."""
    config = config or RevNextConfig.from_env()
    output_dir = Path(output_dir) if output_dir is not None else Path.cwd()
    path1 = output_dir / "Parts_By_Bin_Location.csv"
    path2 = output_dir / "Parts_Price_List.csv"
    with ThreadPoolExecutor(max_workers=2) as executor:
        f1 = executor.submit(
            download_parts_by_bin_report,
            config=config,
            output_path=path1,
        )
        f2 = executor.submit(
            download_parts_price_list_report,
            config=config,
            output_path=path2,
        )
        return [f1.result(), f2.result()]

See the main repo README for the monorepo layout.

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

revnext-0.1.3.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

revnext-0.1.3-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: revnext-0.1.3.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for revnext-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6b46dbed041b397644412d35c9ac8d17c63aad784b67493c5218522fe79944e0
MD5 658649c2bc8bc7172a4f69f3beb20425
BLAKE2b-256 3ed620bdbbf8105c4faafb5bf788a6dacfe541673ffc755da9ebcc56cbcc5d8d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: revnext-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for revnext-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e7d247fc8c97983b9c6a2f68b15220ecb06c8b1d99ff1e91c1d1283aca72f5dd
MD5 c389228d8e851b0d7c61a7d890b39f04
BLAKE2b-256 b97fb65a3b20bfecd1f30b2542c47177e44046428d7a9174db3d1c263bc90caf

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