Skip to main content

Pipe-friendly Microsoft Graph CLI - one-off Graph queries with owa-piggy auth

Project description

owa-graph

Pipe-friendly Microsoft Graph CLI. One-off Graph queries with owa-piggy auth, no token plumbing, no az login, no app registration required.

owa-graph GET /me
owa-graph GET '/users?$top=5' --pretty
owa-graph GET /me/messages --top 10 --select id,subject,from
owa-graph POST /me/sendMail --body @mail.json
owa-graph PATCH /me/messages/AAMk... --body '{"isRead":true}'
owa-graph GET /me/drive/root/children --beta
owa-graph GET /me --curl | pbcopy
owa-graph GET me/events --audience outlook --pretty

Install

brew install damsleth/tap/owa-piggy   # auth broker, required
pip install owa-graph                 # or: uvx owa-graph GET /me

How it works

owa-graph is a thin verb-first wrapper around Microsoft Graph that delegates auth to owa-piggy: on every call it shells out to owa-piggy token --audience graph --json, takes the access token from stdout, and issues the HTTP request with the right base URL and Bearer header.

  • JSON on stdout, logs on stderr.
  • --pretty prints tables for users / messages / drive items, indented JSON for everything else.
  • --curl and --az print the equivalent shell command instead of executing - useful for sharing, scripting, or piping into pbcopy.
  • --beta switches to https://graph.microsoft.com/beta.
  • --audience retargets at any FOCI audience owa-piggy knows about (Outlook REST, Teams, Azure Mgmt, KeyVault, etc.) using the same query ergonomics.

Auth

Default path: owa-graph shells out to owa-piggy for a fresh access token on every call. owa-piggy owns the refresh token; owa-graph stores only an optional profile alias and a default audience in ~/.config/owa-graph/config.

App-registration path (broader Graph scopes): set GRAPH_APP_CLIENT_ID, GRAPH_REFRESH_TOKEN, and GRAPH_TENANT_ID and owa-graph will hit the AAD token endpoint directly with https://graph.microsoft.com/.default scope.

Scope caveat

The OWA first-party SPA client owa-piggy borrows does NOT carry full Graph permissions. Calls like GET /me, /users, /me/joinedTeams, and most directory queries work; calendar/mail/files writes via Graph return 403. Set GRAPH_APP_CLIENT_ID to your own app registration to broaden scope, or use the audience-specific siblings (owa-cal, owa-mail) which target the Outlook REST audience instead.

Development

pip install -e '.[test]'
pytest -q
python -m compileall owa_graph

License

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

owa_graph-0.1.0.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

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

owa_graph-0.1.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: owa_graph-0.1.0.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for owa_graph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dca12975aeed34f18e06b304cc8b8211a9fdd8292a958cf954bb2295044a62e2
MD5 e59a8c90e67fabf4257da22f086616ed
BLAKE2b-256 617dd5f95972abedb4b2eae5765e5e26871e9951dc986a2886e6fc6da4d657ee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: owa_graph-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for owa_graph-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3659f666bfc70e210e39ca7a239222dddfbe59f0ee723956a56bc3d1d18a38b6
MD5 46275b659f93916771e013c774a44a75
BLAKE2b-256 96fe99adcc404080f68f4bef93e41aaa0afdc8459d7906e4a5bc73821d6a5555

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