Skip to content

Latest commit

 

History

History
53 lines (40 loc) · 1.3 KB

README.md

File metadata and controls

53 lines (40 loc) · 1.3 KB

WIZAPI

This module provides a Python interface for making API calls to the Wiz.

Installation

pip install wizapi

Usage

Class: WIZ The Wiz class is designed to interact with the Wiz API. It manages authentication via OAuth2 and supports making requests to the API.

from wizapi import Wiz

# Initialize the API client
w = Wiz(
    client_id="your_client_id",
    client_secret="your_client_secret",
    api_url="https://api.myapp.com",
    auth_url="https://auth.myapp.com/token",
    timeout=60
)

GRAPH_QUERY ="""..."""
GRAPH_VARIABLE={...}
# Make an authenticated API call
result = w.query(query= GRAPH_QUERY, variables=GRAPH_VARIABLE)
print(result)

It supports retrieving configuration from an INI file, JSON file, or environment variables. The module requires a wiz directory in the home directory (~/.api) with the following structure:

~/.wiz/
      ├── config # ini config
      ├── config.json # json config
      └── credentials/
          └── credentials_....json # stored access key

The module allows reusing the access token until it expires by setting stored=True when initializing the Wiz class.

w=Wiz(stored=True)

Methods

  • query() : non-paginated query result (Dict)
  • query_all() : paginated query result (Generator)