From 726298c13acc2f51fccda85035d2b56c23ef4f4f Mon Sep 17 00:00:00 2001 From: edenbr Date: Sun, 17 Apr 2022 16:22:44 +0300 Subject: [PATCH 1/6] Add sg file --- examples_python2/add_simple_gateway.py | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 examples_python2/add_simple_gateway.py diff --git a/examples_python2/add_simple_gateway.py b/examples_python2/add_simple_gateway.py new file mode 100644 index 0000000..1e9c0f9 --- /dev/null +++ b/examples_python2/add_simple_gateway.py @@ -0,0 +1,57 @@ +from __future__ import print_function + +# A package for reading passwords without displaying them on the console. +import argparse +import getpass + +import sys, os +import time + +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + +# cpapi is a library that handles the communication with the Check Point management server. +from cpapi import APIClient, APIClientArgs, APIResponse + + +def main(usera="python-api-wrapper"): + + client_args = APIClientArgs(server="172.23.3.10", port=443, user_agent=usera) + + with APIClient(client_args) as client: + + if client.check_fingerprint() is False: + print("Could not get the server's fingerprint - Check connectivity with the server.") + exit(1) + + # login to server: + login_res = client.login_as_root() + + if login_res.success is False: + print("Login failed:\n{}".format(login_res.error_message)) + exit(1) + else: + print("Logged in kululu") + start = time.time() + res = client.api_call("show-session") + end = time.time() - start + if res.success is True: + + print("The script has been executed successfully in "+ str(end)+"seconds") + + # publish the result + publish_res = client.api_call("publish", {}) + if publish_res.success: + for call in client_args.api_calls: + print(call) + else: + print("Failed to publish the changes.") + else: + print("Failed to run: Error:\n{}".format(res.error_message)) + + +if __name__ == "__main__": + if len(sys.argv)>1: + usera = sys.argv[1] + main(usera) + else: + main() From 1f17a298feb50882a793c108109f14bfa362c676 Mon Sep 17 00:00:00 2001 From: edenbr Date: Mon, 25 Apr 2022 16:12:24 +0300 Subject: [PATCH 2/6] Revert "Add sg file" This reverts commit 726298c13acc2f51fccda85035d2b56c23ef4f4f. --- examples_python2/add_simple_gateway.py | 57 -------------------------- 1 file changed, 57 deletions(-) delete mode 100644 examples_python2/add_simple_gateway.py diff --git a/examples_python2/add_simple_gateway.py b/examples_python2/add_simple_gateway.py deleted file mode 100644 index 1e9c0f9..0000000 --- a/examples_python2/add_simple_gateway.py +++ /dev/null @@ -1,57 +0,0 @@ -from __future__ import print_function - -# A package for reading passwords without displaying them on the console. -import argparse -import getpass - -import sys, os -import time - -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) - -# cpapi is a library that handles the communication with the Check Point management server. -from cpapi import APIClient, APIClientArgs, APIResponse - - -def main(usera="python-api-wrapper"): - - client_args = APIClientArgs(server="172.23.3.10", port=443, user_agent=usera) - - with APIClient(client_args) as client: - - if client.check_fingerprint() is False: - print("Could not get the server's fingerprint - Check connectivity with the server.") - exit(1) - - # login to server: - login_res = client.login_as_root() - - if login_res.success is False: - print("Login failed:\n{}".format(login_res.error_message)) - exit(1) - else: - print("Logged in kululu") - start = time.time() - res = client.api_call("show-session") - end = time.time() - start - if res.success is True: - - print("The script has been executed successfully in "+ str(end)+"seconds") - - # publish the result - publish_res = client.api_call("publish", {}) - if publish_res.success: - for call in client_args.api_calls: - print(call) - else: - print("Failed to publish the changes.") - else: - print("Failed to run: Error:\n{}".format(res.error_message)) - - -if __name__ == "__main__": - if len(sys.argv)>1: - usera = sys.argv[1] - main(usera) - else: - main() From 734e153c8fb028488eb5eb8e81892fd6e6dff66d Mon Sep 17 00:00:00 2001 From: edenbr Date: Mon, 25 Apr 2022 16:18:30 +0300 Subject: [PATCH 3/6] update setup.py --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 98f4d3f..8b5d46b 100644 --- a/setup.py +++ b/setup.py @@ -2,10 +2,11 @@ from setuptools import setup setup( - name="cpapi", + name="cp_mgmt_api_python_sdk", version="1.3.0", author="API team", author_email="api_team@checkpoint.com", + license='Apache 2.0', description="Check Point Management API SDK", long_description="Check Point API Python Development Kit simplifies the usage of the Check Point Management APIs. " "The kit contains the API library project, " @@ -20,5 +21,6 @@ "License :: OSI Approved :: Apache License", "Operating System :: OS Independent", ], + metadata_version="1.2", ) From e45b3eaf70709ca200f3d16f5988d58146eb8d2d Mon Sep 17 00:00:00 2001 From: edenbr Date: Mon, 25 Apr 2022 17:04:26 +0300 Subject: [PATCH 4/6] update setup.py name --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8b5d46b..10ea5af 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup( - name="cp_mgmt_api_python_sdk", + name="cp-mgmt-api-sdk", version="1.3.0", author="API team", author_email="api_team@checkpoint.com", From 6504741acc8244f44ab096fa57c7002e26a14eee Mon Sep 17 00:00:00 2001 From: edenbr Date: Tue, 26 Apr 2022 09:33:30 +0300 Subject: [PATCH 5/6] update setup.py license --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 10ea5af..8e424ba 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ classifiers=[ "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "License :: OSI Approved :: Apache License", + "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ], metadata_version="1.2", From c0bd3f249ff5230bc0407a21962d348d94ccc779 Mon Sep 17 00:00:00 2001 From: edenbr Date: Tue, 26 Apr 2022 09:58:46 +0300 Subject: [PATCH 6/6] update setup.py content type --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8e424ba..98e7797 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ "The kit contains the API library project, " "and sample projects demonstrating the capabilities of the library. " "The kit is python 2 and 3 compatible code.", - long_description_content_type="text", + long_description_content_type="text/plain", url="https://github.com/CheckPointSW/cp_mgmt_api_python_sdk.git", packages=setuptools.find_packages(), classifiers=[