Skip to main content

Shared helper to load Rev credentials and fetch access tokens

Project description

rev-auth-helper

Lightweight helper to load Rev API credentials and fetch access tokens for use in other scripts (like rev-jwt-tools or rev_c2pa_fetcher).

Setup

  • Install: pip install git+https://github.com/agmcin/rev_auth_helper
  • Copy RevCreds.example.json to %USERPROFILE%/.rev/RevCreds.json (default lookup path) or another location.
  • Fill in the API Key and Secret for an account admin user, plus the Rev host URL (include scheme, e.g., https://...), in RevCreds.json. If you keep it elsewhere, pass --creds <path>.

Usage

  • CLI token fetch: python -m rev_auth --host https://b.rev-qa.vbrick.com
    • Optional: --creds <path> to override default, --timeout 10.
  • Library use:
    from rev_auth import get_token
    token, expiration = get_token("https://b.rev-qa.vbrick.com")
    

RevCreds.json format

  • File path: default %USERPROFILE%/.rev/RevCreds.json (see RevCreds.example.json in the repo root for a template).
  • Structure: a JSON list of objects with host, apiKey, and secret (or apiSecret).
  • Minimal example:
    [
      {
        "host": "b.rev-qa.vbrick.com",
        "apiKey": "your-api-key",
        "secret": "your-api-secret"
      },
      {
        "host": "prod.rev.vbrick.com",
        "apiKey": "prod-api-key",
        "secret": "prod-api-secret"
      }
    ]
    
  • The helper normalizes the host: a full URL is OK; matching is done on the hostname. Multiple environments are supported; the best match wins.

What it does

  • Normalizes a host or full URL.
  • Loads creds map from JSON.
  • Selects best-matching host entry.
  • Calls POST /api/v2/authenticate to get vbrickAccessToken.
  • Returns token and expiration

Config file

See RevCreds.example.json for structure (top-level list of objects with host, apiKey, secret). Multiple environments are supported; the helper picks the matching host.

Notes

  • Depends only on requests.
  • No network calls until you invoke token retrieval. CLI outputs token to stdout for easy piping into other scripts.

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

rev_auth_helper-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

rev_auth_helper-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file rev_auth_helper-0.1.0.tar.gz.

File metadata

  • Download URL: rev_auth_helper-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for rev_auth_helper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a05ebdcf1c2bf219ae3d28d7216904834afb14d86bd1b30bfadd06fd35e9a1a7
MD5 d1d5b8f75e84ff134fa901c3099cdb7d
BLAKE2b-256 e80284640d9b4b2ec11807e1e5acde3df54daee978db2ae98c0f881b84b20f24

See more details on using hashes here.

File details

Details for the file rev_auth_helper-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rev_auth_helper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 21ebff6bcd1a7f719eb853db46aa564d3f0a85fff19d7de973cfccccb1bf61da
MD5 efbc4255f2d4a0e56c843e2cc037000f
BLAKE2b-256 931c2eff26d484ec22528303b8b6553b605a80372cfa75951e9feeb063a872cf

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