Skip to main content

Clockwise Assignment Completion SDK

Overview

Description

This SDK provides a set of tools to manage assignments from Clockwise. Primarily, it allows you to fetch, represent, and mark assignments as complete.

Features

  • Infuzu Authentication: Represents authentication credentials for Infuzu with methods for signature generation.
  • Assignment Representation: Represents an Assignment fetched from Clockwise.
  • Complete Assignment Representation: Represents a completed assignment in Clockwise.
  • Fetch and Complete Assignments: Functionality to retrieve and mark assignments as complete.

Setup Instructions

Install the Package using pip:

pip install infuzu-python-sdk

Usage

InfuzuCredentials Class

This class is used to represent authentication credentials for Infuzu.

from infuzu.auth import InfuzuCredentials

credentials: InfuzuCredentials = InfuzuCredentials(secret_id="YOUR_SECRET_ID", secret_key="YOUR_SECRET_KEY")

Methods & Classmethods:

  • from_file(filepath: str) -> 'InfuzuCredentials': Create an InfuzuCredentials instance from a JSON file.
  • from_dict(data: dict[str, str]) -> 'InfuzuCredentials': Create an InfuzuCredentials instance from a dictionary.

Clockwise Assignments

Working with Clockwise assignments involves fetching and completing tasks using the Assignment and CompleteAssignment classes.

Fetch an Assignment

from infuzu.clockwise.assignments import get_assignment, Assignment

# Fetch an assignment from Clockwise
try:
    assignment: Assignment = get_assignment(credentials)
    print(f"Fetched assignment: {assignment}")
except NoContentError:
    print("No assignments available at the moment.")

Completing an Assignment

from datetime import datetime
from infuzu.clockwise.assignments import assignment_complete, CompleteAssignment
from infuzu.clockwise.errors import NoContentError

# Mark an assignment as complete
try:
    assignment: Assignment = get_assignment(credentials)

    # Placeholder start and end datetimes for the assignment execution
    start_dt = datetime.utcnow()
    end_dt = datetime.utcnow()

    # Placeholder for your code to execute the assignment
    # -- Your code here --

    # You should capture the execution details and construct an APIResponse accordingly
    response = APIResponse(...)  # Replace with actual response data

    complete_assignment: CompleteAssignment = CompleteAssignment(
        assignment=assignment,
        start_datetime=start_dt,
        end_datetime=end_dt,
        response=response
    )

    assignment_complete(credentials, complete_assignment)
    print("Assignment marked as completed.")
except NoContentError:
    print("No assignments available to complete.")

Clockwise Rules

The SDK allows you to manage rules in Clockwise, including creating new rules, deleting existing ones, and retrieving execution logs.

Create a Rule

from infuzu.clockwise.rules import create_rule, Rule
from infuzu.clockwise.utils.enums.api_calls import HttpMethod
from datetime import timedelta

rule: Rule = Rule(
    name="Daily Data Backup",
    url="https://api.yourcompany.com/data/backup",
    interval=timedelta(days=1),
    http_method=HttpMethod.POST
)

# Create the rule in Clockwise
rule_id = create_rule(credentials, rule)
print(f"Rule created with ID: {rule_id}")

Delete a Rule

from infuzu.clockwise.rules import delete_rule

# Delete Rule by ID
rule_deleted_success = delete_rule(credentials, rule_id="123456")
if rule_deleted_success:
    print("Rule deleted successfully.")
else:
    print("There was an error deleting the rule.")

Get Rule Execution Logs

from infuzu.clockwise.rules import get_rule_logs

# Retrieve execution logs for a specific rule
executions = get_rule_logs(credentials, rule_id="123456")
for execution in executions:
    print(f"Execution details: {execution}")

Important Note

Please handle your credentials securely and ensure you manage exceptions when dealing with API calls.

Contributing

As this is an open-source project hosted on GitHub, your contributions and improvements are welcome! Follow these general steps for contributing:

  1. Fork the Repository: Start by forking the main repository to your personal GitHub account.

  2. Clone the Forked Repository: Clone your forked repository to your local machine.

    git clone https://github.com/Infuzu/InfuzuPythonSDK.git
    
  3. Create a New Branch: Before making any changes, create a new branch:

    git checkout -b feature-name
    
  4. Make Your Changes: Implement your features, enhancements, or bug fixes.

  5. Commit & Push:

    git add .
    git commit -m "Descriptive commit message about changes"
    git push origin feature-name
    
  6. Create a Pull Request (PR): Go to your forked repository on GitHub and click the "New Pull Request" button. Make sure the base fork is the original repository, and the head fork is your repository and branch. Fill out the PR template with the necessary details.

Remember to always be respectful and kind in all interactions with the community. It's all about learning, growing, and helping each other succeed!

Acknowledgments

Crafted with 💙 by Yidi Sprei for Infuzu. Kudos to all contributors and the expansive Infuzu and Python community for encouragement and motivation.

Metadata

Release files for infuzu-python-sdk 0.87.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for infuzu-python-sdk 0.87.2
File Size Uploaded
infuzu_python_sdk-0.87.2.tar.gz 25.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for infuzu-python-sdk 0.87.2
File Interpreter ABI Platform
infuzu_python_sdk-0.87.2-py3-none-any.whl Python 3 none any Details

Total release size: 64.8 kB

Release files / infuzu_python_sdk-0.87.2.tar.gz

Download URL infuzu_python_sdk-0.87.2.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8aca560cf956b443c071779069b9de880e81b19cb45175be9e1683cc57f95ed1
BLAKE2b-256 checksum
How to use checksums
623109abf358f07f61e139c29eef3e26813a513d550a24c9e3760fcc9abb1987
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / infuzu_python_sdk-0.87.2-py3-none-any.whl

Download URL infuzu_python_sdk-0.87.2-py3-none-any.whl
Size 39.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
13d789bf4402a0ab47abaf3a109f7fc0749ec5f7fb1206cb3f2cfcad2b5d21da
BLAKE2b-256 checksum
How to use checksums
0cf63b93834225465b455f8edf5a8a97fed5d95910ef91fb36c95115ef881339
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release history Release notifications | RSS feed

This release

0.87.2 This release

2 release files

0.87

2 release files

0.86

2 release files

0.85

2 release files

0.84

2 release files

0.83

2 release files

0.82

2 release files

0.81

2 release files

0.80

2 release files

0.79

2 release files

0.78

2 release files

0.77

2 release files

0.76

2 release files

0.75

2 release files

0.74

2 release files

0.73

2 release files

0.72

2 release files

0.71

2 release files

0.70

2 release files

0.69

2 release files

0.68

2 release files

0.67

2 release files

0.66

2 release files

0.65

2 release files

0.64

2 release files

0.63

2 release files

0.62

2 release files

0.61

2 release files

0.60

2 release files

0.59

2 release files

0.58

2 release files

0.57

2 release files

0.56

2 release files

0.55

2 release files

0.54

2 release files

0.53

2 release files

0.52

2 release files

0.51

2 release files

0.50

2 release files

0.49

2 release files

0.48

2 release files

0.47

2 release files

0.45

2 release files

0.44

2 release files

0.43

2 release files

0.42

2 release files

0.41

2 release files

0.40

2 release files

0.39

2 release files

0.38

2 release files

0.37

2 release files

0.36

2 release files

0.35

2 release files

0.34

2 release files

0.33

2 release files

0.32

2 release files

0.31

2 release files

0.30

2 release files

0.29

2 release files

0.28

2 release files

0.27

2 release files

0.26

2 release files

0.25

2 release files

0.24

2 release files

0.23

2 release files

0.22

2 release files

0.21

2 release files

0.20

2 release files

0.19

2 release files

0.18

2 release files

0.17

2 release files

0.16

2 release files

0.15

2 release files

0.14

2 release files

0.13

2 release files

0.12

2 release files

0.11

2 release files

0.10

2 release files

0.9

2 release files

0.8

2 release files

0.7

2 release files

0.6

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page