Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 6fd8be3

Browse files
authored
Pancloud 2.0 alpha (#135)
* Updated LICENSE * Update HISTORY.rst * Update example * Switch from path to endpoint kwarg * Bump version to alpha2 * Bump package version to alpha2
1 parent 6353fc9 commit 6fd8be3

File tree

7 files changed

+24
-19
lines changed

7 files changed

+24
-19
lines changed

HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
History
33
=======
44

5+
2.0.0-alpha2 (2020-01-09)
6+
-------------------------
7+
8+
* Fixed invalid use of `HTTPClient` class `path` keyword arg in `Credentials`
9+
510
2.0.0-alpha1 (2019-11-21)
611
-------------------------
712

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
ISC License
33

4-
Copyright (c) 2018, Palo Alto Networks
4+
Copyright (c) 2020, Palo Alto Networks
55

66
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
77

README.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Installation
4747

4848
From PyPI::
4949

50-
$ pip install pancloud
50+
$ pip install pancloud==2.0.0a2
5151

5252
Install From GitHub
5353
-------------------
@@ -86,18 +86,18 @@ Example
8686
8787
>>> import pancloud
8888
>>> c = pancloud.Credentials()
89-
>>> ls = pancloud.LoggingService(credentials=c)
90-
>>> query = {
91-
... "query": "SELECT * FROM panw.traffic LIMIT 1",
92-
... "startTime": 1938869090,
93-
... "endTime": 1938869150,
94-
... "maxWaitTime": 10000
89+
>>> qs = pancloud.QueryService(credentials=c)
90+
>>> query_params = {
91+
... "query": "SELECT * FROM `587718190.firewall.traffic` LIMIT 1",
92+
... "language": "bigquery"
9593
... }
96-
>>> q = ls.query(query)
94+
>>> q = qs.create_query(query_params=query_params)
9795
>>> q.status_code
98-
200
96+
201
9997
>>> q.json()
100-
{u'result': {u'esQuery': {u'table': [u'panw.traffic'], u'selections': [], u'params': {}, u'query': {u'aggregations': {}, u'size': 1}}, u'esResult': {u'hits': {u'hits': [{u'_score': 2, u'_type': u'traffic', u'_id': u'117270018_lcaas:0:9379670:1', u'_source': {u'logset': u'LCaaS', u'traffic_flags': 0, u'parent_start_time': 0, u'inbound_if': u'ethernet1/1', u'dstloc': u'10.0.0.0-10.255.255.255', u'natdport': 0, u'time_generated': 1560175638, u'recsize': 1958, u'chunks_sent': 0, u'to': u'l3-untrust', u'non-standard-dport': 0, u'receive_time': 1560175660, u'elapsed': 0, u'seqno': 51422235, u'pbf_s2c': 0, u'vsys': u'vsys1', u'bytes': 196, u'subtype': u'end', u'subcategory-of-app': u'internet-utility', u'vsys_id': 1, u'actionflags': -9223372036854776000L, u'pkts_sent': 1, u'sport': 0, u'is-saas-of-app': 0, u'category': u'any', u'ui-srcloc': u'Singapore', u'bytes_received': 98, u'container': 0, u'dst': u'10.10.0.2', u'customer-id': u'117270018', u'packet_capture': 0, u'srcloc': u'SG', u'natsport': 0, u'parent_session_id': 0, u'proxy': 0, u'ui-dstloc': u'10.0.0.0-10.255.255.255', u'src': u'203.208.197.133', u'config_ver': 2304, u'sanctioned-state-of-app': 0, u'fwd': 1, u'technology-of-app': u'network-protocol', u'bytes_sent': 98, u'chunks_received': 0, u'dg_hier_level_3': 0, u'dg_hier_level_2': 0, u'dg_hier_level_1': 16, u'dg_hier_level_4': 0, u'repeatcnt': 1, u'natsrc': u'0.0.0.0', u'app': u'ping', u'characteristic-of-app': [u'tunnel-other-application', u'prone-to-misuse', u'is-saas'], u'chunks': 0, u'non_std_dport': 1, u'decrypt_mirror': 0, u'action_source': u'from-policy', u'from': u'l3-untrust', u'url_denied': 0, u'assoc_id': 0, u'log_feat_bit1': 0, u'start': 1560175625, u'cloud_hostname': u'ngfw-1', u'pbf_c2s': 0, u'sym_return': 0, u'captive_portal': 0, u'outbound_if': u'ethernet1/1', u'tunnelid_imsi': 0, u'sessionid': 407532, u'category-of-app': u'general-internet', u'tunnel': u'N/A', u'type': u'traffic', u'mptcp_on': 0, u'recon_excluded': 0, u'http2_connection': 0, u'tunnel_inspected': 0, u'risk-of-app': u'2', u'serial': u'007200000046172', u'is_fwaas': 0, u'proto': u'icmp', u'is_phishing': 0, u'is_gpaas': 0, u'nat': 0, u'tunneled-app': u'untunneled', u'natdst': u'0.0.0.0', u'time_received': 1560175638, u'users': u'203.208.197.133', u'rule_uuid': u'd6992de4-5523-4ba8-b9e9-a99fe9dbfda4', u'pkts_received': 1, u'action': u'allow', u'is_dup_log': 0, u'exported': 0, u'session_end_reason': u'aged-out', u'transaction': 0, u'packets': 2, u'flag': 0, u'rule': u'intrazone-default', u'device_name': u'ngfw-1', u'flags': 1048676, u'dport': 0}, u'_index': u'117270018_panw.all_2019060600-2019062600_000000'}], u'total': 22942, u'maxScore': 2}, u'from': 0, u'completed': True, u'took': 185, u'timed_out': False, u'state': u'COMPLETED', u'id': u'e2a685ce-0b21-41d6-a050-4e371e456817', u'size': 1}}, u'sequenceNo': 0, u'queryId': u'e2a685ce-0b21-41d6-a050-4e371e456817', u'clientParameters': {}, u'queryStatus': u'JOB_FINISHED'}
98+
{'jobId': '40fedce6-ddf5-44cf-9af2-7c3d5303f388', 'uri': '/query/v2/jobs/40fedce6-ddf5-44cf-9af2-7c3d5303f388'}
99+
>>> results = qs.get_job_results(job_id='40fedce6-ddf5-44cf-9af2-7c3d5303f388')
100+
>>> results.json()
101101
102102
Contributors
103103
------------

pancloud/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""Main package for pancloud."""
44

55
__author__ = "Palo Alto Networks"
6-
__version__ = "2.0.0-alpha1"
6+
__version__ = "2.0.0-alpha2"
77

88
from .exceptions import ( # noqa: F401
99
PanCloudError,

pancloud/credentials.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def fetch_tokens(
331331
method="POST",
332332
url=self.token_url,
333333
json=data,
334-
path="/api/oauth2/RequestToken",
334+
endpoint="/api/oauth2/RequestToken",
335335
auth=None,
336336
**kwargs
337337
)
@@ -459,7 +459,7 @@ def refresh(self, access_token=None, **kwargs):
459459
r = self._httpclient.request(
460460
method="POST",
461461
url=self.developer_token_url,
462-
path="/request_token",
462+
endpoint="/request_token",
463463
headers={
464464
"Authorization": "Bearer {}".format(
465465
self.developer_token
@@ -480,7 +480,7 @@ def refresh(self, access_token=None, **kwargs):
480480
method="POST",
481481
url=self.token_url,
482482
json=data,
483-
path="/api/oauth2/RequestToken",
483+
endpoint="/api/oauth2/RequestToken",
484484
**kwargs
485485
)
486486
else:
@@ -522,7 +522,7 @@ def revoke_access_token(self, **kwargs):
522522
method="POST",
523523
url=self.token_url,
524524
json=data,
525-
path="/api/oauth2/RevokeToken",
525+
endpoint="/api/oauth2/RevokeToken",
526526
**kwargs
527527
)
528528
if not r.ok:
@@ -549,7 +549,7 @@ def revoke_refresh_token(self, **kwargs):
549549
method="POST",
550550
url=self.token_url,
551551
json=data,
552-
path="/api/oauth2/RevokeToken",
552+
endpoint="/api/oauth2/RevokeToken",
553553
**kwargs
554554
)
555555
if not r.ok:

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 2.0.0-alpha1
2+
current_version = 2.0.0-alpha2
33
commit = True
44
tag = True
55

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
setup(
2222
name="pancloud",
23-
version="2.0.0-alpha1",
23+
version="2.0.0-alpha2",
2424
description="Python idiomatic SDK for Cortex™.",
2525
long_description=readme + "\n\n" + history,
2626
author="Steven Serrata",

0 commit comments

Comments
 (0)