Skip to main content

Python SDK for the 重庆环宇星科身份中台 V2.0

Project description

cqhyxk SDK

Python SDK for the 身份中台V2.0 OpenAPI (Identity Management Platform V2.0 OpenAPI)

License: MIT Python Version

Overview

This SDK provides a Python interface to interact with the Identity Management Platform V2.0 API, allowing you to manage personnel, organizations, tags, and event subscriptions programmatically.

The SDK provides:

  • Type Safety: All requests and responses are validated with Pydantic models
  • Environment Configuration: Load credentials from environment variables
  • Complete API Coverage: All endpoints from the OpenAPI specification
  • Error Handling: Comprehensive error handling with custom exceptions
  • Documentation: Detailed documentation for all methods

Installation

Install the package using pip:

pip install cqhyxk

Or using uv:

uv pip install cqhyxk

Quick Start

  1. Set up environment variables by creating a .env file (see .env.example):

    CQHYXK_BASEURL=https://your-domain/backend/school-platform/openapi
    CQHYXK_APP_KEY=your_app_key_here
    CQHYXK_APP_SECRET=your_app_secret_here
    
  2. Initialize the client and make API calls:

    from cqhyxk import CqhyxkClient
    from cqhyxk.models import IdentityPageRequest
    
    # Initialize the client (credentials loaded from environment variables)
    client = CqhyxkClient()
    
    # Example: Get first 10 identities
    request = IdentityPageRequest(current=0, size=10)
    response = client.get_identity_list(request)
    
    print(f"Retrieved {len(response.data.content)} identities")
    for identity in response.data.content:
        print(f"- {identity.name} ({identity.sourceUserId})")
    

Configuration

The SDK supports configuration via environment variables:

  • CQHYXK_BASEURL: The base URL for the API (default: https://your-domain/backend/school-platform/openapi)
  • CQHYXK_APP_KEY: Your application key for API authentication
  • CQHYXK_APP_SECRET: Your application secret for API authentication

You can also pass these values directly to the constructor:

client = CqhyxkClient(
    app_key="your_app_key",
    app_secret="your_app_secret", 
    base_url="https://your-api-domain.com"
)

Available Methods

Personnel Methods

  • get_identity_list(request): Get paginated list of personnel identity information
  • get_face_photos(source_user_id): Get face photos by student ID

Organization Methods

  • get_org_list(physical, internal, org_id): Get list of organizations

Tag Methods

  • get_tag_list(tag_id): Get list of tags
  • get_member_tags_page(request): Get paginated list of personnel tag relationships

Event Subscription Methods

  • add_subscription(request): Subscribe to events
  • cancel_subscription(event_type): Cancel event subscription

For detailed documentation of each method, including parameters and response formats, check the docstrings in the source code.

Examples

Run the example script to see the SDK in action:

python example.py

Make sure your environment variables are properly configured before running the example.

Development

To install the package in development mode:

git clone https://github.com/liudonghua123/cqhyxk.git
cd cqhyxk
pip install -e .

Or with uv:

uv pip install -e .

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests if applicable
  5. Commit your changes (git commit -m 'Add some amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any issues, please file a bug report in the GitHub repository or contact the maintainers.

API Documentation

For detailed API documentation, refer to the original OpenAPI specification.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cqhyxk-0.0.1.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cqhyxk-0.0.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file cqhyxk-0.0.1.tar.gz.

File metadata

  • Download URL: cqhyxk-0.0.1.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cqhyxk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 34a681e77bc7b7491ed1a2f722bd9e1a0a039a780b3a4e6f777f8d76f0936423
MD5 448a808a1467fd783d1689a4eddb6c58
BLAKE2b-256 7f4a9ec035f29454b6823491de46b556115a8fc0741cc2bc47a9b8984d01a3bc

See more details on using hashes here.

File details

Details for the file cqhyxk-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: cqhyxk-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cqhyxk-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c5b758ace6432debcd61fe6d9bf671001b21df1f0abf531109e31c4dde77ff82
MD5 134d7840ae81ebd66d37d46cb550ab90
BLAKE2b-256 a910767aafd92f0408182caeb3f35b27e43b89b7edc75af5644629cf46adc915

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page