Skip to content

Commit

Permalink
Alpha8 (#144)
Browse files Browse the repository at this point in the history
* Update docstrings

* Fix for bug #143

* Bump version

* Update HISTORY.md
  • Loading branch information
sserrata committed Mar 25, 2020
1 parent 2aa5c5d commit 2b3bd42
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# History

## 2.0.0-alpha8 (2020-03-25)

- Updated docstrings
- Bug fix for issue #143

## 2.0.0-alpha7 (2020-03-23)

- Updated SDK name in HTTPClient default headers
Expand Down
2 changes: 1 addition & 1 deletion pan_cortex_data_lake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""Main package for cortex."""

__author__ = "Palo Alto Networks"
__version__ = "2.0.0-a7"
__version__ = "2.0.0-a8"

from .exceptions import ( # noqa: F401
CortexError,
Expand Down
14 changes: 7 additions & 7 deletions pan_cortex_data_lake/httpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ def __init__(self, **kwargs):
Parameters:
auto_refresh (bool): Perform token refresh following HTTP 401 response from server. Defaults to ``True``.
auto_retry (bool): Retry last failed HTTP request following a token refresh. Defaults to ``True``.
credentials (Credentials): :class:`~pancloud.credentials.Credentials` object. Defaults to ``None``.
enforce_json (bool): Require properly-formatted JSON or raise :exc:`~pancloud.exceptions.PanCloudError`. Defaults to ``False``.
credentials (Credentials): :class:`~pan_cortex_data_lake.credentials.Credentials` object. Defaults to ``None``.
enforce_json (bool): Require properly-formatted JSON or raise :exc:`~pan_cortex_data_lake.exceptions.CortecError`. Defaults to ``False``.
force_trace (bool): If ``True``, forces trace and forces ``x-request-id`` to be returned in the response headers. Defaults to ``False``.
port (int): TCP port to append to URL. Defaults to ``443``.
raise_for_status (bool): If ``True``, raises :exc:`~pancloud.exceptions.HTTPError` if status_code not in 2XX. Defaults to ``False``.
raise_for_status (bool): If ``True``, raises :exc:`~pan_cortex_data_lake.exceptions.HTTPError` if status_code not in 2XX. Defaults to ``False``.
url (str): URL to send API requests to - gets combined with ``port`` and :meth:`~request` ``path`` parameter. Defaults to ``None``.
Args:
Expand Down Expand Up @@ -164,9 +164,9 @@ def _send_request(self, enforce_json, method, raise_for_status, url, **kwargs):
"""Send HTTP request.
Args:
enforce_json (bool): Require properly-formatted JSON or raise :exc:`~pancloud.exceptions.PanCloudError`. Defaults to ``False``.
enforce_json (bool): Require properly-formatted JSON or raise :exc:`~pan_cortex_data_lake.exceptions.CortecError`. Defaults to ``False``.
method (str): HTTP method.
raise_for_status (bool): If ``True``, raises :exc:`~pancloud.exceptions.HTTPError` if status_code not in 2XX. Defaults to ``False``.
raise_for_status (bool): If ``True``, raises :exc:`~pan_cortex_data_lake.exceptions.HTTPError` if status_code not in 2XX. Defaults to ``False``.
url (str): Request URL.
**kwargs (dict): Re-packed key-word arguments.
Expand Down Expand Up @@ -195,9 +195,9 @@ def request(self, **kwargs):
flexibility and efficiency.
Parameters:
enforce_json (bool): Require properly-formatted JSON or raise :exc:`~pancloud.exceptions.HTTPError`. Defaults to ``False``.
enforce_json (bool): Require properly-formatted JSON or raise :exc:`~pan_cortex_data_lake.exceptions.HTTPError`. Defaults to ``False``.
path (str): URI path to append to URL. Defaults to ``empty``.
raise_for_status (bool): If ``True``, raises :exc:`~pancloud.exceptions.HTTPError` if status_code not in 2XX. Defaults to ``False``.
raise_for_status (bool): If ``True``, raises :exc:`~pan_cortex_data_lake.exceptions.HTTPError` if status_code not in 2XX. Defaults to ``False``.
Args:
**kwargs: Supported :class:`~requests.Session` and :class:`~requests.adapters.HTTPAdapter` parameters.
Expand Down
14 changes: 7 additions & 7 deletions pan_cortex_data_lake/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def cancel_job(self, job_id=None, **kwargs):
Args:
job_id (str): Specifies the ID of the query job.
**kwargs: Supported :meth:`~pancloud.httpclient.HTTPClient.request` parameters.
**kwargs: Supported :meth:`~pan_cortex_data_lake.httpclient.HTTPClient.request` parameters.
Returns:
requests.Response: Requests Response() object.
Expand All @@ -99,7 +99,7 @@ def create_query(self, job_id=None, query_params=None, **kwargs):
Args:
job_id (str): Specifies the ID of the query job. (optional)
query_params (dict): Query parameters.
**kwargs: Supported :meth:`~pancloud.httpclient.HTTPClient.request` parameters.
**kwargs: Supported :meth:`~pan_cortex_data_lake.httpclient.HTTPClient.request` parameters.
Returns:
requests.Response: Requests Response() object.
Expand Down Expand Up @@ -128,7 +128,7 @@ def get_job(self, job_id=None, **kwargs):
Args:
job_id (str): Specifies the ID of the query job.
params (dict): Payload/request dictionary.
**kwargs: Supported :meth:`~pancloud.httpclient.HTTPClient.request` parameters.
**kwargs: Supported :meth:`~pan_cortex_data_lake.httpclient.HTTPClient.request` parameters.
Returns:
requests.Response: Requests Response() object.
Expand Down Expand Up @@ -162,7 +162,7 @@ def get_job_results(
page_number (int): Return the nth page from the result set as specified by this parameter.
page_size (int): If specified, limits the size of a batch of results to the specified value. If un-specified, backend picks a size that may provide best performance.
result_format (str): valuesArray or valuesJson.
**kwargs: Supported :meth:`~pancloud.httpclient.HTTPClient.request` parameters.
**kwargs: Supported :meth:`~pan_cortex_data_lake.httpclient.HTTPClient.request` parameters.
Returns:
requests.Response: Requests Response() object.
Expand Down Expand Up @@ -212,7 +212,7 @@ def iter_job_results(
page_number (int): Return the nth page from the result set as specified by this parameter.
page_size (int): If specified, limits the size of a batch of results to the specified value. If un-specified, backend picks a size that may provide best performance.
result_format (str): valuesArray or valuesJson.
**kwargs: Supported :meth:`~pancloud.httpclient.HTTPClient.request` parameters.
**kwargs: Supported :meth:`~pan_cortex_data_lake.httpclient.HTTPClient.request` parameters.
Yields:
requests.Response: Requests Response() object.
Expand Down Expand Up @@ -249,7 +249,7 @@ def iter_job_results(
else:
yield r
break
elif r.json()["state"] == ("RUNNING" or "PENDING"):
elif r.json()["state"] in ("RUNNING", "PENDING"):
yield r
time.sleep(1)
elif r.json()["state"] == "FAILED":
Expand All @@ -275,7 +275,7 @@ def list_jobs(
state (str): Job state, e.g. 'RUNNING', 'PENDING', 'FAILED', 'DONE'.
job_type (str): Query type hint.
tenant_id (str): Tenant ID.
**kwargs: Supported :meth:`~pancloud.httpclient.HTTPClient.request` parameters.
**kwargs: Supported :meth:`~pan_cortex_data_lake.httpclient.HTTPClient.request` parameters.
Returns:
requests.Response: Requests Response() object.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.0.0a7
current_version = 2.0.0a8
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

setup(
name="pan-cortex-data-lake",
version="2.0.0-a7",
version="2.0.0-a8",
description="Python idiomatic SDK for Cortex™ Data Lake.",
long_description=readme + "\n\n" + history,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 2b3bd42

Please sign in to comment.