Skip to main content

ten99policy Python Library

A Python library for interacting with the 1099Policy API.

Python Tests PyPI version Python Versions

Overview

The ten99policy library provides a simple and intuitive way to integrate 1099Policy's services into your Python applications. It allows you to manage entities, contractors, jobs, policies, quotes, assignments, and more through the 1099Policy API.

Table of Contents

Installation

Install the package using pip:

pip install ten99policy

Configuration

Before using the library, configure it with your API credentials and settings.

import ten99policy

# Configuration variables
ten99policy.api_key = 'your_api_key_here'
ten99policy.environment = 'production'  # or 'sandbox' for testing
ten99policy.api_base = 'https://api.1099policy.com'  # Default API base URL
ten99policy.verify_ssl_certs = True  # Set to False if you encounter SSL issues
ten99policy.log = 'debug'  # Logging level ('debug' or 'info')

Configuration Parameters:

  • api_key: Your API key for authentication.
  • environment: The API environment to use ('production' or 'sandbox').
  • api_base: The base URL for API requests.
  • verify_ssl_certs: Whether to verify SSL certificates.
  • log: Logging level for console output ('debug' or 'info').

Usage

Entities

Creating an Entity

import ten99policy

resource = ten99policy.Entities.create(
    name="Brooklyn Bowl",
    coverage_limit={
        "aggregate_limit": "200000000",
        "occurrence_limit": "100000000",
    },
    address={
        "line1": "3639 18th St",
        "line2": "",
        "locality": "San Francisco",
        "region": "CA",
        "postalcode": "94110",
    },
    required_coverage=["general", "workers-comp"],
)

Updating an Entity

resource = ten99policy.Entities.modify(
    "en_C9Z2DmfHSF",  # Replace with an existing entity ID
    name="California Roll",
)

Fetching the List of Entities

resource = ten99policy.Entities.list()

Retrieving an Entity

resource = ten99policy.Entities.retrieve("en_BUcNa8jMrq")  # Replace with an existing entity ID

Deleting an Entity

resource = ten99policy.Entities.delete("en_C9Z2DmfHSF")  # Replace with an existing entity ID

Contractors

Creating a Contractor

resource = ten99policy.Contractors.create(
    first_name="John",
    last_name="Doe",
    email="john@doe.com",
    phone="415-111-1111",
    tax_identification="123-456789",
    address={
        "country": "USA",
        "line1": "2211 Mission St",
        "locality": "San Francisco",
        "region": "CA",
        "postalcode": "94110",
    },
)

Updating a Contractor

resource = ten99policy.Contractors.modify(
    "cn_tS3wR3UQ5q",  # Replace with an existing contractor ID
    email="john.doe@gmail.com",
    first_name="George",
)

Fetching the List of Contractors

resource = ten99policy.Contractors.list()

Retrieving a Contractor

resource = ten99policy.Contractors.retrieve("cn_9TPKz6B9so")  # Replace with an existing contractor ID

Deleting a Contractor

resource = ten99policy.Contractors.delete("cn_tS3wR3UQ5q")  # Replace with an existing contractor ID

Insurance Application Sessions

Creating an Insurance Application Session

resource = ten99policy.InsuranceApplicationSessions.create(
    quote="qt_yVEnbNaWh6",
    success_url="http://example.com/success",
    cancel_url="http://example.com/cancel",
)

Updating a Session

resource = ten99policy.InsuranceApplicationSessions.modify(
    "ias_01HZSB299T5D9SCNY98T8P10KC",  # Replace with an existing session ID
    success_url="http://example.com/success",
    cancel_url="http://example.com/cancel",
)

Fetching the List of Insurance Application Sessions

resource = ten99policy.InsuranceApplicationSessions.list()

Retrieving an Insurance Application Session

resource = ten99policy.InsuranceApplicationSessions.retrieve(
    "ias_01HZSB299T5D9SCNY98T8P10KC"  # Replace with an existing session ID
)

Jobs

Creating a Job

resource = ten99policy.Jobs.create(
    name="Truck driver",
    description="Requires a truck",
    duration_hours=20,
    wage=100,
    years_experience=20,
    wage_type="flatfee",
    entity="en_FwZfQRe4aW",
    category_code="jc_MTqpkbkp6G",
)

Updating a Job

resource = ten99policy.Jobs.modify(
    "jb_C9Z2DmfHSF",  # Replace with an existing job ID
    name="Mechanic",
)

Fetching the List of Jobs

resource = ten99policy.Jobs.list()

Retrieving a Job

resource = ten99policy.Jobs.retrieve("jb_C9Z2DmfHSF")  # Replace with an existing job ID

Deleting a Job

resource = ten99policy.Jobs.delete("jb_C9Z2DmfHSF")  # Replace with an existing job ID

Policies

Creating a Policy

resource = ten99policy.Policies.create(
    quote_id="qt_UPmEfS6nNK",
    is_active=True,
)

Updating a Policy

resource = ten99policy.Policies.modify(
    "po_C9Z2DmfHSF",  # Replace with an existing policy ID
    is_active=False,
)

Fetching the List of Policies

resource = ten99policy.Policies.list()

Retrieving a Policy

resource = ten99policy.Policies.retrieve("po_C9Z2DmfHSF")  # Replace with an existing policy ID

Deleting a Policy

resource = ten99policy.Policies.delete("po_C9Z2DmfHSF")  # Replace with an existing policy ID

Quotes

Creating a Quote

resource = ten99policy.Quotes.create(
    job="jb_jsb9KEcTpc",
    contractor="cn_yJBbMeq9QA",
    coverage_type=["general", "workers-comp"],
)

Updating a Quote

resource = ten99policy.Quotes.modify(
    "qt_C9Z2DmfHSF",  # Replace with an existing quote ID
    name="Mechanic",
)

Fetching the List of Quotes

resource = ten99policy.Quotes.list()

Retrieving a Quote

resource = ten99policy.Quotes.retrieve("qt_C9Z2DmfHSF")  # Replace with an existing quote ID

Assignments

Creating an Assignment

resource = ten99policy.Assignments.create(
    contractor="cn_kjLKMtApTv",
    job="jb_D6ZSaoa2MV",
)

Updating an Assignment

resource = ten99policy.Assignments.modify(
    "as_sF3yUB3BYY",  # Replace with an existing assignment ID
    contractor="cn_kjLKMtApTv",
)

Fetching the List of Assignments

resource = ten99policy.Assignments.list()

Retrieving an Assignment

resource = ten99policy.Assignments.retrieve("as_sF3yUB3BYY")  # Replace with an existing assignment ID

Deleting an Assignment

resource = ten99policy.Assignments.delete("as_xyz")  # Replace with an existing assignment ID

Error Handling

The ten99policy library raises exceptions for API errors. Use try-except blocks to handle potential errors gracefully.

try:
    resource = ten99policy.Entities.create(
        name="New Entity",
        # ... other parameters
    )
except ten99policy.error.APIError as e:
    print(f"API Error: {e}")
except ten99policy.error.AuthenticationError as e:
    print(f"Authentication Error: {e}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

Additional Resources

Support

If you encounter any issues or have questions about using the ten99policy library, please open an issue on the GitHub repository or contact our support team at support@1099policy.com.

License

This library is distributed under the MIT License. See the LICENSE file in the repository for more information.


Note: Replace placeholder IDs (e.g., "en_C9Z2DmfHSF") with actual IDs from your 1099Policy account when running the code examples.

Metadata

Release files for ten99policy 1.1.13

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

Source distribution (sdist)

Source distribution for ten99policy 1.1.13
File Size Uploaded Provenance Actions
ten99policy-1.1.13.tar.gz 52.4 kB Without provenance Details for ten99policy-1.1.13.tar.gz

Release files / ten99policy-1.1.13.tar.gz

Download URL ten99policy-1.1.13.tar.gz
Size 52.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e4d5874a7e5b1188270bdcaa4d4c1443090acc26c366059e24b2824fee0f51e3
BLAKE2b-256 checksum
How to use checksums
e798c1de9033c0341f9f77d91c14394c90a3cbd30c819bd55ca8e076309e460e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for ten99policy 1.1.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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