Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ assignees: ''

### Basic Information

- py42 version: <!-- get the version using `pip show py42`-->
- pycpg version: <!-- get the version using `pip show pycpg`-->
- python version: <!-- get the version using `python --version`-->
- operating system:
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Feature request
about: Suggest an idea for py42
about: Suggest an idea for pycpg
title: "[Enhancement] YOUR IDEA!"
labels: enhancement
assignees: ''
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
path: py42
path: pycpg
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: pip install tox==3.24.1
- name: Run Unit tests
run: cd py42; tox -e py # Run tox using the version of Python in `PATH`
run: cd pycpg; tox -e py # Run tox using the version of Python in `PATH`
- name: Submit coverage report
uses: codecov/codecov-action@v1.0.7
with:
file: py42/coverage.xml
file: pycpg/coverage.xml
- name: Checkout mock servers
uses: actions/checkout@v2
with:
Expand All @@ -42,19 +42,12 @@ jobs:
sudo tee -a /etc/hosts <<EOF
127.0.0.1 localhost
127.0.0.1 core
127.0.0.1 alerts
127.0.0.1 alert-rules
127.0.0.1 detection-lists
127.0.0.1 audit-log
127.0.0.1 file-events
127.0.0.1 storage
127.0.0.1 preservation-data-service
127.0.0.1 exfiltration-data-service
127.0.0.1 connected-server
127.0.0.1 cases
127.0.0.1 trusted-activities-service
EOF
- name: Start up the mock servers
run: cd code42-mock-servers; docker compose up -d --build
- name: Run the integration testss
run: sleep 15; cd py42; tox -e integration
run: sleep 15; cd pycpg; tox -e integration
8 changes: 4 additions & 4 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "CLA Assistant"
name: "CLA Assistant - - Not Functioning"
on:
issue_comment:
types: [created]
Expand All @@ -19,14 +19,14 @@ jobs:
PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
path-to-signatures: '.cla_signatures.json'
path-to-cla-document: 'https://code42.github.io/code42-cla/Code42_Individual_Contributor_License_Agreement'
path-to-cla-document: 'https://crashPlan.github.io/crashPlan-cla/CrashPlan_Individual_Contributor_License_Agreement'
# branch should not be protected
branch: 'main'
allowlist: alang13,unparalleled-js,kiran-chaudhary,ceciliastevens,DiscoRiver,annie-payseur,amoravec,patelsagar192,ryan-haley-code42,timabrmsn,tora-kozic
allowlist: alang13,unparalleled-js,kiran-chaudhary,ceciliastevens,DiscoRiver,annie-payseur,amoravec,patelsagar192,ryan-haley-crashPlan,timabrmsn,tora-kozic

#below are the optional inputs - If the optional inputs are not given, then default values will be taken
#remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository)
remote-repository-name: code42-cla
remote-repository-name: crashPlan-cla
#create-file-commit-message: 'For example: Creating file for storing CLA Signatures'
#signed-commit-message: 'For example: $contributorName has signed the CLA in #$pullRequestNo'
#custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign'
Expand Down
2 changes: 1 addition & 1 deletion CODECLASSIFICATION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CODECLASSIFICATION for py42
# CODECLASSIFICATION for pycpg

# Specify all repository branches as non-production (catch all)
/refs/heads/* non-prod
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @code42/literally-skynet
* @crashPlan
30 changes: 15 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

## Set up your Development environment

The very first thing to do is to fork the py42 repo, clone it, and make it your working directory!
The very first thing to do is to fork the pycpg repo, clone it, and make it your working directory!

```bash
git clone https://github.com/myaccount/py42
cd py42
git clone https://github.com/myaccount/pycpg
cd pycpg
```

To set up your development environment, create a python virtual environment and activate it. This keeps your dependencies sandboxed so that they are unaffected by (and do not affect) other python packages you may have installed.
Expand All @@ -48,31 +48,31 @@ Then, create your virtual environment.

```bash
pyenv install 3.9.10
pyenv virtualenv 3.9.10 py42
pyenv activate py42
pyenv virtualenv 3.9.10 pycpg
pyenv activate pycpg
```

**Note**: Py42 for end users supports Pythons versions <3.6 and <4 - However due to some of the build dependencies, you'll need a version >=3.7 for your virtual environment. Use `pyenv --versions` to see all versions available for install. There are some known issues installing python 3.6 with pyenv on certain OS.
**Note**: Pycpg for end users supports Pythons versions <3.6 and <4 - However due to some of the build dependencies, you'll need a version >=3.7 for your virtual environment. Use `pyenv --versions` to see all versions available for install. There are some known issues installing python 3.6 with pyenv on certain OS.

If running into issues on Big Sur(Version 11) while installing python 3.6 the below may work

```bash
pyenv install --patch 3.6.14 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch)
```

Use `source deactivate` to exit the virtual environment and `pyenv activate py42` to reactivate it.
Use `source deactivate` to exit the virtual environment and `pyenv activate pycpg` to reactivate it.

### Windows/Linux

Install a version of python 3.6 or higher from [python.org](https://python.org).
Next, in a directory somewhere outside the project, create and activate your virtual environment:

```bash
python -m venv py42
python -m venv pycpg
# macOS/Linux
source py42/bin/activate
source pycpg/bin/activate
# Windows
.\py42\Scripts\Activate
.\pycpg\Scripts\Activate
```

To leave the virtual environment, simply use:
Expand All @@ -82,7 +82,7 @@ deactivate

## Installation

Next, with your virtual environment activated, install py42 and its development dependencies. The `-e` option installs py42 in
Next, with your virtual environment activated, install pycpg and its development dependencies. The `-e` option installs pycpg in
["editable mode"](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs).

```bash
Expand Down Expand Up @@ -159,8 +159,8 @@ def test_add_one_and_one_equals_two():

#### Integration tests

If not using the mock server, set the environment variables `C42_HOST`, `C42_USER`,
and `C42_PW` with CCA credentials. Otherwise, the integration tests default to using
If not using the mock server, set the environment variables `CPG_HOST`, `CPG_USER`,
and `CPG_PW` with CCA credentials. Otherwise, the integration tests default to using
`http://127.0.0.1:4200`, which is the same address that the mock server is set to run on.

To execute integration tests:
Expand All @@ -176,7 +176,7 @@ Follow [Google's format](https://google.github.io/styleguide/pyguide.html#38-com

### Generating documentation

py42 uses [Sphinx](http://www.sphinx-doc.org/) to generate documentation.
pycpg uses [Sphinx](http://www.sphinx-doc.org/) to generate documentation.

#### Performing a test build

Expand Down Expand Up @@ -217,7 +217,7 @@ Document all notable consumer-affecting changes in CHANGELOG.md per principles a

When you're satisfied with your changes, open a PR and fill out the pull request template file. We recommend prefixing the name of your branch and/or PR title with `bugfix`, `chore`, or `feature` to help quickly categorize your change. Your unit tests and other checks will run against all supported python versions when you do this.

For contributions from non-Code42 employees, we require you to agree to our [Contributor License Agreement](https://code42.github.io/code42-cla/Code42_Individual_Contributor_License_Agreement).
For contributions from non-CrashPlan employees, we require you to agree to our [Contributor License Agreement](https://crashPlan.github.io/crashPlan-cla/CrashPlan_Individual_Contributor_License_Agreement).

On submission of your first PR, a GitHub action will run requiring you to reply in a comment with your affirmation of the CLA before the PR will be able to be merged.

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Code42 Software
Copyright (c) 2020 CrashPlan Software

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
53 changes: 27 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
# CrashPlan fork of pycpg, this will become the official CrashPlan Python SDK

# py42, the official Code42 Python SDK

![Build status](https://github.com/code42/py42/workflows/build/badge.svg)
[![codecov.io](https://codecov.io/github/code42/py42/coverage.svg?branch=main)](https://codecov.io/github/code42/py42?branch=main)
[![versions](https://img.shields.io/pypi/pyversions/py42.svg)](https://pypi.org/project/py42/)

![Build status](https://github.com/CrashPlan-Labs/pycpg/workflows/build/badge.svg)
[![codecov.io](https://codecov.io/github/crashPlan/pycpg/coverage.svg?branch=main)](https://codecov.io/github/crashPlan/pycpg?branch=main)
[![versions](https://img.shields.io/pypi/pyversions/pycpg.svg)](https://pypi.org/project/pycpg/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Documentation Status](https://readthedocs.org/projects/py42/badge/?version=latest)](https://py42docs.code42.com/en/latest/?badge=latest)
[![Documentation Status](https://readthedocs.org/projects/pycpg/badge/?version=latest)](https://pycpgdocs.crashPlan.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
`pycpg` is a Python wrapper around the CrashPlan REST APIs that also provides several other useful utility methods.
It is designed to be used for developing your own tools for working with CrashPlan 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)
- CrashPlan Server 6.8.x+ or cloud environment (e.g. console.us.crashPlan.com or crashplan.com)

## Installation

Run the `setup.py` script to install the py42 package and its dependencies on your system.
Run the `setup.py` script to install the pycpg package and its dependencies on your system.
You will likely need administrative privileges for this.

```bash
$ python setup.py install
```

## Hello, py42
## Hello, pycpg

Here's a simple example to verify the installation and your server/account.

Expand All @@ -39,18 +40,18 @@ $ python
Import a couple essentials

```python
>>> import py42.sdk
>>> import py42.util as util
>>> import pycpg.sdk
>>> import pycpg.util as util
```

Initialize the client.

```python
>>> sdk = py42.sdk.from_local_account("https://console.us.code42.com", "john.doe", "password")
>>> sdk = pycpg.sdk.from_local_account("https://console.us1.crashPlan.com", "john.doe", "password")
```
or alternatively
```
>>> sdk = py42.sdk.from_jwt_provider("https://console.us.code42.com", jwt_provider_function)
>>> sdk = pycpg.sdk.from_jwt_provider("https://console.us1.crashPlan.com", jwt_provider_function)
```

Get and print your user information.
Expand Down Expand Up @@ -103,12 +104,12 @@ There are a few default settings that affect the behavior of the client.
| 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.
To override these settings, import `pycpg.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 pycpg.sdk
import pycpg.settings as settings
import logging

settings.verify_ssl_certs = False
Expand All @@ -120,17 +121,17 @@ 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")
sdk = pycpg.sdk.from_local_account("https://console.us1.crashPlan.com", "my_username", "my_password")
```

## Usage

The SDK object opens availability to APIs across the Code42 environment, including storage nodes.
The SDK object opens availability to APIs across the CrashPlan environment, including storage nodes.

```python
import py42.sdk
import pycpg.sdk

sdk = py42.sdk.from_local_account("https://console.us.code42.com", "my_username", "my_password")
sdk = pycpg.sdk.from_local_account("https://console.us1.crashPlan.com", "my_username", "my_password")

# clients are organized by feature groups and accessible under the sdk object

Expand All @@ -155,16 +156,16 @@ with open("/path/to/my/file", 'wb') as f:
f.write(chunk)

# search file events
from py42.sdk.queries.fileevents.file_event_query import FileEventQuery
from py42.sdk.queries.fileevents.filters import *
from pycpg.sdk.queries.fileevents.file_event_query import FileEventQuery
from pycpg.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:
For complete documentation on the CrashPlan 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)
- [Introduction to the CrashPlan API](https://support.crashplan.com/hc/en-us/articles/9057001723917--CrashPlan-API-syntax-and-usage)
- [CrashPlan API documentation viewers](https://support.crashplan.com/hc/en-us/articles/9057096803469--CrashPlan-API-documentation-viewer-reference)
12 changes: 6 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
import os
import sys

import py42.__version__ as meta
import pycpg.__version__ as meta

# -- Project information -----------------------------------------------------

project = "py42"
copyright = "2022, Code42 Software"
author = "Code42 Software"
project = "pycpg"
copyright = "2025, CrashPlan Software"
author = "CrashPlan Software"

# The short X.Y version
version = f"py42 v{meta.__version__}"
version = f"pycpg v{meta.__version__}"
# The full version, including alpha/beta/rc tags
release = f"py42 v{meta.__version__}"
release = f"pycpg v{meta.__version__}"


# -- General configuration ---------------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# py42, the Code42 Python SDK
# pycpg, the CrashPlan Python SDK

```{eval-rst}
.. toctree::
Expand All @@ -17,11 +17,11 @@
```


[![license](https://img.shields.io/pypi/l/py42.svg)](https://pypi.org/project/py42/)
[![versions](https://img.shields.io/pypi/pyversions/py42.svg)](https://pypi.org/project/py42/)
[![license](https://img.shields.io/pypi/l/pycpg.svg)](https://pypi.org/project/pycpg/)
[![versions](https://img.shields.io/pypi/pyversions/pycpg.svg)](https://pypi.org/project/pycpg/)

`py42` is a Python wrapper around the Code42 REST APIs that also provides several utility methods. Use `py42` to
develop your own tools for working with Code42 data while avoiding the overhead
`pycpg` is a Python wrapper around the CrashPlan REST APIs that also provides several utility methods. Use `pycpg` to
develop your own tools for working with CrashPlan data while avoiding the overhead
of session / authentication management.

## Features
Expand Down
31 changes: 0 additions & 31 deletions docs/methoddocs/alertrules.md

This file was deleted.

Loading
Loading