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 using cookies/session.

Install: pip install revnext
Or from repo root: pip install -e ./packages/revnext

Quick start

You need a cookies file (Chrome export for your RevNext domain). Then call the download functions with your instance URL and download location.

Download one report with a specific file path

from pathlib import Path
from revnext import download_parts_by_bin_report, download_parts_price_list_report

base_url = "https://yoursite.revolutionnext.com.au"
cookies_path = Path("revnext-cookies.json")

# Parts by Bin Location
path1 = download_parts_by_bin_report(
    base_url=base_url,
    output_path=Path("C:/Reports/parts_by_bin.csv"),
    cookies_path=cookies_path,
)

# Parts Price List
path2 = download_parts_price_list_report(
    base_url=base_url,
    output_path=Path("C:/Reports/parts_price_list.csv"),
    cookies_path=cookies_path,
)

Example: download both reports (implement in your project)

Copy this into your project to run both reports in sequence:

from pathlib import Path
from typing import Optional

from revnext import download_parts_by_bin_report, download_parts_price_list_report


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

Example: download both reports in parallel (implement in your project)

Copy this into your project to run both reports concurrently (Promise.all-style):

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

from revnext import download_parts_by_bin_report, download_parts_price_list_report


def download_all_reports_parallel(
    cookies_path: Optional[Path | str] = None,
    output_dir: Optional[Path | str] = None,
    base_url: Optional[str] = None,
) -> list[Path]:
    """Run both reports in parallel. Returns the list of paths where files were saved."""
    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,
            cookies_path=cookies_path,
            output_path=path1,
            base_url=base_url,
        )
        f2 = executor.submit(
            download_parts_price_list_report,
            cookies_path=cookies_path,
            output_path=path2,
            base_url=base_url,
        )
        return [f1.result(), f2.result()]

Using environment variables

Set REVOLUTIONNEXT_URL and optionally REVOLUTIONNEXT_COOKIES_PATH; then you can omit base_url and cookies_path in code.

See the main repo README for full configuration options.

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.2.tar.gz (8.6 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.2-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: revnext-0.1.2.tar.gz
  • Upload date:
  • Size: 8.6 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.2.tar.gz
Algorithm Hash digest
SHA256 b52692bb3af187c3514b4ac8740a6d57377128e0e235b78af3383d613ed5bc74
MD5 07e3959e942a6d3bc4f82ba226f79fea
BLAKE2b-256 1848a17d06f849f7f320c57b05206bb8c172c77ded7d661d73739d7bfcaf1eaa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: revnext-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ebe04ec5f270f5926cd35e0415adb0356bb5a1a83919085bbcdd8fd09e94db51
MD5 52644115d6d027a0a8332a23e5277e86
BLAKE2b-256 9d4ff4d76936f3fc5c77bce774919e29020443742c24abd7a8ac80a4afb0678f

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