PaloAltoNetworks / pan-cortex-data-lake-python

Python idiomatic SDK for Cortex™ Data Lake.
https://cortex.pan.dev/docs/data_lake/develop/cdl_python_installation
ISC License
44 stars 18 forks source link
api applicationframework cortex data datalake directory directory-sync directory-sync-service event event-service logging logging-service paloalto paloaltonetworks pan pancloud panw python rest-api sdk

Tests PyPI upload PyPI version

Palo Alto Networks Cortex™ Data Lake SDK

Python idiomatic SDK for the Cortex™ Data Lake.

The Palo Alto Networks Cortex Data Lake Python SDK was created to assist developers with programmatically interacting with the Palo Alto Networks Cortex™ Data Lake API.

The primary goal is to provide full, low-level API coverage for the following Cortex™ Data Lake services:

The secondary goal is to provide coverage, in the form of helpers, for common tasks/operations.

Resources:


Features

Status

The Palo Alto Networks Cortex™ Data Lake Python SDK is considered beta at this time.

Installation

From PyPI:

pip install pan-cortex-data-lake

From source:

pip install .

To run tests:

pip install .[test]

Obtaining and Using OAuth 2.0 Tokens

If you're an app developer, work with your Developer Relations representative to obtain your OAuth2 credentials. API Explorer may optionally be used to generate a Developer Token, which can also be used to authenticate with the API. For details on API Explorer developer tokens, please visit https://cortex.pan.dev/docs/data_lake/learn/developer_tokens.

Example

from pan_cortex_data_lake import Credentials, QueryService

c = Credentials()
qs = QueryService(credentials=c)
query_params = {
    "query": "SELECT * FROM `1234567890.firewall.traffic` LIMIT 1",
}
q = qs.create_query(query_params=query_params)
results = qs.get_job_results(job_id=q.json()['jobId'])
print(results.json())

Contributors