diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-15 05:37:38 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-15 05:37:38 +0000 |
commit | 75c6dcc90b69600556caf9307d36105f835012f4 (patch) | |
tree | 7ef3ba85b912a891dc1f9d182fbf3be74461d674 | |
parent | 58a1793615d0b2184d79f3f518f28754e3df4f6d (diff) |
automatic import of python-py42
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-py42.spec | 592 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 594 insertions, 0 deletions
@@ -0,0 +1 @@ +/py42-1.26.1.tar.gz diff --git a/python-py42.spec b/python-py42.spec new file mode 100644 index 0000000..2a7d6d8 --- /dev/null +++ b/python-py42.spec @@ -0,0 +1,592 @@ +%global _empty_manifest_terminate_build 0 +Name: python-py42 +Version: 1.26.1 +Release: 1 +Summary: The Official Code42 Python API Client +License: MIT License +URL: https://github.com/code42/py42 +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/34/4d/4857787432953c675e9c783e52e616aa5c8f52a0d853b1652c56473e1cda/py42-1.26.1.tar.gz +BuildArch: noarch + +Requires: python3-requests +Requires: python3-flake8 +Requires: python3-pytest +Requires: python3-pytest-cov +Requires: python3-pytest-mock +Requires: python3-tox +Requires: python3-sphinx +Requires: python3-myst-parser +Requires: python3-sphinx-rtd-theme +Requires: python3-docutils + +%description + +# py42, the official Code42 Python SDK + + +[](https://codecov.io/github/code42/py42?branch=main) +[](https://pypi.org/project/py42/) +[](https://github.com/psf/black) +[](https://py42docs.code42.com/en/latest/?badge=latest) + + +`py42` is a Python wrapper around the Code42 REST APIs that also provides several other useful utility methods. +It is designed to be used for developing your own tools for working with Code42 data while avoiding the overhead +of session / authentication management. + +## Requirements + +- Python 3.6.0+ +- Code42 Server 6.8.x+ or cloud environment (e.g. console.us.code42.com or crashplan.com) + +## Installation + +Run the `setup.py` script to install the py42 package and its dependencies on your system. +You will likely need administrative privileges for this. + +```bash +$ python setup.py install +``` + +## Hello, py42 + +Here's a simple example to verify the installation and your server/account. + +Launch the Python interpreter + +```bash +$ python +``` + +Import a couple essentials + +```python +>>> import py42.sdk +>>> import py42.util as util +``` + +Initialize the client. + +```python +>>> sdk = py42.sdk.from_local_account("https://console.us.code42.com", "john.doe", "password") +``` +or alternatively +``` +>>> sdk = py42.sdk.from_jwt_provider("https://console.us.code42.com", jwt_provider_function) +``` + +Get and print your user information. + +```python +>>> response = sdk.users.get_current() +>>> util.print_response(response) +``` + +You should see something like the following: + +```json +{ + "username": "john.doe", + "orgName": "ACME Organization", + "userId": 123456, + "emailPromo": true, + "licenses": [], + "modificationDate": "2018-08-29T15:32:56.995-05:00", + "blocked": false, + "usernameIsAnEmail": true, + "userUid": "1234567890abcdef", + "userExtRef": null, + "email": "john.doe@acme.com", + "status": "Active", + "localAuthenticationOnly": false, + "orgUid": "123456789123456789", + "passwordReset": true, + "active": true, + "creationDate": "2012-01-16T11:25:43.545-06:00", + "orgType": "BUSINESS", + "firstName": "John", + "lastName": "Doe", + "notes": null, + "orgId": 123456, + "quotaInBytes": -1, + "invited": false +} +``` + +## Configuration + +There are a few default settings that affect the behavior of the client. + +| Name | Description | Default | +| ---- | ----------- | ------- | +| verify_ssl_certs | Controls whether the SDK verifies the server's certificate.<br>Possible values: `True`, `False`, or a path to a CA bundle to use.| `True` +| proxies | Dictionary mapping protocol or protocol and hostname to the URL of the proxy.<br>See [the Requests library's documentation on proxies](https://requests.readthedocs.io/en/latest/user/advanced/?highlight=proxy#proxies) for more info.| `None` +| debug.level | Controls log level | `logging.NOTSET` +| debug.logger | Controls logger used | `logging.Logger` with `StreamHandler` sending to `sys.stderr` +| items_per_page | Controls how many items are retrieved per request for methods that loops over several "pages" of items in order to collect them all. | 500 + +To override these settings, import `py42.settings` and override values as necessary before creating the client. + For example, to disable certificate validation in a dev environment: + +```python +import py42.sdk +import py42.settings as settings +import logging + +settings.verify_ssl_certs = False + +# customize logging +custom_logger = logging.getLogger("my_app") +handler = logging.FileHandler("my_app.log") +custom_logger.addHandler(handler) +settings.debug.logger = custom_logger +settings.debug.level = logging.DEBUG + +sdk = py42.sdk.from_local_account("https://console.us.code42.com", "my_username", "my_password") +``` + +## Usage + +The SDK object opens availability to APIs across the Code42 environment, including storage nodes. + +```python +import py42.sdk + +sdk = py42.sdk.from_local_account("https://console.us.code42.com", "my_username", "my_password") + +# clients are organized by feature groups and accessible under the sdk object + +# get information about the current user. +current_user = sdk.users.get_current() + +# page through all devices available to this user. +for device_page in sdk.devices.get_all(): + for device in device_page["computers"]: + print(device) + +# page through all orgs available to this user. +for org_page in sdk.orgs.get_all(): + for org in org_page["orgs"]: + print(org) + +# save a copy of a file from an archive this user has access to into the current working directory. +stream_response = sdk.archive.stream_from_backup("/full/path/to/file.txt", "1234567890") +with open("/path/to/my/file", 'wb') as f: + for chunk in stream_response.iter_content(chunk_size=128): + if chunk: + f.write(chunk) + +# search file events +from py42.sdk.queries.fileevents.file_event_query import FileEventQuery +from py42.sdk.queries.fileevents.filters import * + +query = FileEventQuery.all(MD5.eq("e804d1eb229298b04522c5504b8131f0")) +file_events = sdk.securitydata.search_file_events(query) +``` + +## Additional Resources + +For complete documentation on the Code42 web API that backs this SDK, here are some helpful resources: + +- [Introduction to the Code42 API](https://support.code42.com/Administrator/Cloud/Monitoring_and_managing/Introduction_to_the_Code42_API) +- [Code42 API documentation viewers](https://support.code42.com/Administrator/Cloud/Monitoring_and_managing/Introduction_to_the_Code42_API/Code42_API_documentation_viewer) + + +%package -n python3-py42 +Summary: The Official Code42 Python API Client +Provides: python-py42 +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-py42 + +# py42, the official Code42 Python SDK + + +[](https://codecov.io/github/code42/py42?branch=main) +[](https://pypi.org/project/py42/) +[](https://github.com/psf/black) +[](https://py42docs.code42.com/en/latest/?badge=latest) + + +`py42` is a Python wrapper around the Code42 REST APIs that also provides several other useful utility methods. +It is designed to be used for developing your own tools for working with Code42 data while avoiding the overhead +of session / authentication management. + +## Requirements + +- Python 3.6.0+ +- Code42 Server 6.8.x+ or cloud environment (e.g. console.us.code42.com or crashplan.com) + +## Installation + +Run the `setup.py` script to install the py42 package and its dependencies on your system. +You will likely need administrative privileges for this. + +```bash +$ python setup.py install +``` + +## Hello, py42 + +Here's a simple example to verify the installation and your server/account. + +Launch the Python interpreter + +```bash +$ python +``` + +Import a couple essentials + +```python +>>> import py42.sdk +>>> import py42.util as util +``` + +Initialize the client. + +```python +>>> sdk = py42.sdk.from_local_account("https://console.us.code42.com", "john.doe", "password") +``` +or alternatively +``` +>>> sdk = py42.sdk.from_jwt_provider("https://console.us.code42.com", jwt_provider_function) +``` + +Get and print your user information. + +```python +>>> response = sdk.users.get_current() +>>> util.print_response(response) +``` + +You should see something like the following: + +```json +{ + "username": "john.doe", + "orgName": "ACME Organization", + "userId": 123456, + "emailPromo": true, + "licenses": [], + "modificationDate": "2018-08-29T15:32:56.995-05:00", + "blocked": false, + "usernameIsAnEmail": true, + "userUid": "1234567890abcdef", + "userExtRef": null, + "email": "john.doe@acme.com", + "status": "Active", + "localAuthenticationOnly": false, + "orgUid": "123456789123456789", + "passwordReset": true, + "active": true, + "creationDate": "2012-01-16T11:25:43.545-06:00", + "orgType": "BUSINESS", + "firstName": "John", + "lastName": "Doe", + "notes": null, + "orgId": 123456, + "quotaInBytes": -1, + "invited": false +} +``` + +## Configuration + +There are a few default settings that affect the behavior of the client. + +| Name | Description | Default | +| ---- | ----------- | ------- | +| verify_ssl_certs | Controls whether the SDK verifies the server's certificate.<br>Possible values: `True`, `False`, or a path to a CA bundle to use.| `True` +| proxies | Dictionary mapping protocol or protocol and hostname to the URL of the proxy.<br>See [the Requests library's documentation on proxies](https://requests.readthedocs.io/en/latest/user/advanced/?highlight=proxy#proxies) for more info.| `None` +| debug.level | Controls log level | `logging.NOTSET` +| debug.logger | Controls logger used | `logging.Logger` with `StreamHandler` sending to `sys.stderr` +| items_per_page | Controls how many items are retrieved per request for methods that loops over several "pages" of items in order to collect them all. | 500 + +To override these settings, import `py42.settings` and override values as necessary before creating the client. + For example, to disable certificate validation in a dev environment: + +```python +import py42.sdk +import py42.settings as settings +import logging + +settings.verify_ssl_certs = False + +# customize logging +custom_logger = logging.getLogger("my_app") +handler = logging.FileHandler("my_app.log") +custom_logger.addHandler(handler) +settings.debug.logger = custom_logger +settings.debug.level = logging.DEBUG + +sdk = py42.sdk.from_local_account("https://console.us.code42.com", "my_username", "my_password") +``` + +## Usage + +The SDK object opens availability to APIs across the Code42 environment, including storage nodes. + +```python +import py42.sdk + +sdk = py42.sdk.from_local_account("https://console.us.code42.com", "my_username", "my_password") + +# clients are organized by feature groups and accessible under the sdk object + +# get information about the current user. +current_user = sdk.users.get_current() + +# page through all devices available to this user. +for device_page in sdk.devices.get_all(): + for device in device_page["computers"]: + print(device) + +# page through all orgs available to this user. +for org_page in sdk.orgs.get_all(): + for org in org_page["orgs"]: + print(org) + +# save a copy of a file from an archive this user has access to into the current working directory. +stream_response = sdk.archive.stream_from_backup("/full/path/to/file.txt", "1234567890") +with open("/path/to/my/file", 'wb') as f: + for chunk in stream_response.iter_content(chunk_size=128): + if chunk: + f.write(chunk) + +# search file events +from py42.sdk.queries.fileevents.file_event_query import FileEventQuery +from py42.sdk.queries.fileevents.filters import * + +query = FileEventQuery.all(MD5.eq("e804d1eb229298b04522c5504b8131f0")) +file_events = sdk.securitydata.search_file_events(query) +``` + +## Additional Resources + +For complete documentation on the Code42 web API that backs this SDK, here are some helpful resources: + +- [Introduction to the Code42 API](https://support.code42.com/Administrator/Cloud/Monitoring_and_managing/Introduction_to_the_Code42_API) +- [Code42 API documentation viewers](https://support.code42.com/Administrator/Cloud/Monitoring_and_managing/Introduction_to_the_Code42_API/Code42_API_documentation_viewer) + + +%package help +Summary: Development documents and examples for py42 +Provides: python3-py42-doc +%description help + +# py42, the official Code42 Python SDK + + +[](https://codecov.io/github/code42/py42?branch=main) +[](https://pypi.org/project/py42/) +[](https://github.com/psf/black) +[](https://py42docs.code42.com/en/latest/?badge=latest) + + +`py42` is a Python wrapper around the Code42 REST APIs that also provides several other useful utility methods. +It is designed to be used for developing your own tools for working with Code42 data while avoiding the overhead +of session / authentication management. + +## Requirements + +- Python 3.6.0+ +- Code42 Server 6.8.x+ or cloud environment (e.g. console.us.code42.com or crashplan.com) + +## Installation + +Run the `setup.py` script to install the py42 package and its dependencies on your system. +You will likely need administrative privileges for this. + +```bash +$ python setup.py install +``` + +## Hello, py42 + +Here's a simple example to verify the installation and your server/account. + +Launch the Python interpreter + +```bash +$ python +``` + +Import a couple essentials + +```python +>>> import py42.sdk +>>> import py42.util as util +``` + +Initialize the client. + +```python +>>> sdk = py42.sdk.from_local_account("https://console.us.code42.com", "john.doe", "password") +``` +or alternatively +``` +>>> sdk = py42.sdk.from_jwt_provider("https://console.us.code42.com", jwt_provider_function) +``` + +Get and print your user information. + +```python +>>> response = sdk.users.get_current() +>>> util.print_response(response) +``` + +You should see something like the following: + +```json +{ + "username": "john.doe", + "orgName": "ACME Organization", + "userId": 123456, + "emailPromo": true, + "licenses": [], + "modificationDate": "2018-08-29T15:32:56.995-05:00", + "blocked": false, + "usernameIsAnEmail": true, + "userUid": "1234567890abcdef", + "userExtRef": null, + "email": "john.doe@acme.com", + "status": "Active", + "localAuthenticationOnly": false, + "orgUid": "123456789123456789", + "passwordReset": true, + "active": true, + "creationDate": "2012-01-16T11:25:43.545-06:00", + "orgType": "BUSINESS", + "firstName": "John", + "lastName": "Doe", + "notes": null, + "orgId": 123456, + "quotaInBytes": -1, + "invited": false +} +``` + +## Configuration + +There are a few default settings that affect the behavior of the client. + +| Name | Description | Default | +| ---- | ----------- | ------- | +| verify_ssl_certs | Controls whether the SDK verifies the server's certificate.<br>Possible values: `True`, `False`, or a path to a CA bundle to use.| `True` +| proxies | Dictionary mapping protocol or protocol and hostname to the URL of the proxy.<br>See [the Requests library's documentation on proxies](https://requests.readthedocs.io/en/latest/user/advanced/?highlight=proxy#proxies) for more info.| `None` +| debug.level | Controls log level | `logging.NOTSET` +| debug.logger | Controls logger used | `logging.Logger` with `StreamHandler` sending to `sys.stderr` +| items_per_page | Controls how many items are retrieved per request for methods that loops over several "pages" of items in order to collect them all. | 500 + +To override these settings, import `py42.settings` and override values as necessary before creating the client. + For example, to disable certificate validation in a dev environment: + +```python +import py42.sdk +import py42.settings as settings +import logging + +settings.verify_ssl_certs = False + +# customize logging +custom_logger = logging.getLogger("my_app") +handler = logging.FileHandler("my_app.log") +custom_logger.addHandler(handler) +settings.debug.logger = custom_logger +settings.debug.level = logging.DEBUG + +sdk = py42.sdk.from_local_account("https://console.us.code42.com", "my_username", "my_password") +``` + +## Usage + +The SDK object opens availability to APIs across the Code42 environment, including storage nodes. + +```python +import py42.sdk + +sdk = py42.sdk.from_local_account("https://console.us.code42.com", "my_username", "my_password") + +# clients are organized by feature groups and accessible under the sdk object + +# get information about the current user. +current_user = sdk.users.get_current() + +# page through all devices available to this user. +for device_page in sdk.devices.get_all(): + for device in device_page["computers"]: + print(device) + +# page through all orgs available to this user. +for org_page in sdk.orgs.get_all(): + for org in org_page["orgs"]: + print(org) + +# save a copy of a file from an archive this user has access to into the current working directory. +stream_response = sdk.archive.stream_from_backup("/full/path/to/file.txt", "1234567890") +with open("/path/to/my/file", 'wb') as f: + for chunk in stream_response.iter_content(chunk_size=128): + if chunk: + f.write(chunk) + +# search file events +from py42.sdk.queries.fileevents.file_event_query import FileEventQuery +from py42.sdk.queries.fileevents.filters import * + +query = FileEventQuery.all(MD5.eq("e804d1eb229298b04522c5504b8131f0")) +file_events = sdk.securitydata.search_file_events(query) +``` + +## Additional Resources + +For complete documentation on the Code42 web API that backs this SDK, here are some helpful resources: + +- [Introduction to the Code42 API](https://support.code42.com/Administrator/Cloud/Monitoring_and_managing/Introduction_to_the_Code42_API) +- [Code42 API documentation viewers](https://support.code42.com/Administrator/Cloud/Monitoring_and_managing/Introduction_to_the_Code42_API/Code42_API_documentation_viewer) + + +%prep +%autosetup -n py42-1.26.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-py42 -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 1.26.1-1 +- Package Spec generated @@ -0,0 +1 @@ +66f4dfb99efc139e2b09826422255d3e py42-1.26.1.tar.gz |