Skip to main content

A Tool for OVINC Union API

Project description

OVINC Union Api SDK

PyPI version License: MIT Python

中文文档

A Python client for OVINC Union API, providing easy access to authentication, notifications, and TCaptcha verification.

Installation

pip install ovinc-client

Usage

Initialization

from ovinc_client.client import OVINCClient

APP_CODE = "your_app_code"
APP_SECRET = "your_app_secret"
OVINC_API_URL = "https://api.ovinc.cn"

client = OVINCClient(app_code=APP_CODE, app_secret=APP_SECRET, union_api_url=OVINC_API_URL)

Notifications (Notice)

Send Email

response = client.notice.mail({
    "to": "user@example.com",
    "subject": "Hello",
    "content": "This is a test email."
})
print(response.data)

Send SMS

response = client.notice.sms({
    "phone": "13800138000",
    "template_id": "123456",
    "params": ["1234"]
})
print(response.data)

Send Robot Message

response = client.notice.robot({
    "channel": "wecom",
    "content": "Hello from robot"
})
print(response.data)

Authentication (Auth)

Verify Code

response = client.auth.verify_code({
    "code": "123456",
    "key": "user_identifier"
})
print(response.data)

TCaptcha Verification

This module requires Django settings configuration.

Settings:

# settings.py
CAPTCHA_TCLOUD_ID = "your_tencent_cloud_id"
CAPTCHA_TCLOUD_KEY = "your_tencent_cloud_key"
CAPTCHA_APP_ID = "your_captcha_app_id"
CAPTCHA_APP_SECRET = "your_captcha_app_secret"
CAPTCHA_ENABLED = True

Usage:

from ovinc_client.tcaptcha.utils import TCaptchaVerify

# In your view or API
def verify_captcha(request):
    user_ip = request.META.get("REMOTE_ADDR")
    ticket = request.data.get("ticket")
    randstr = request.data.get("randstr")
    ret = request.data.get("ret")
    
    verifier = TCaptchaVerify(
        user_ip=user_ip,
        ticket=ticket,
        randstr=randstr,
        ret=ret
    )
    
    if verifier.verify():
        return "Success"
    else:
        return "Failed"

License

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

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

ovinc_client-0.4.13.tar.gz (28.2 kB view details)

Uploaded Source

Built Distribution

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

ovinc_client-0.4.13-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

Details for the file ovinc_client-0.4.13.tar.gz.

File metadata

  • Download URL: ovinc_client-0.4.13.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for ovinc_client-0.4.13.tar.gz
Algorithm Hash digest
SHA256 d16e8e355a9b0122c9d8f4ac9e0fc6f98f199c98827b86d5e5987aa4aaf9c50a
MD5 0889889be1035cc241c1b5f238a647b7
BLAKE2b-256 b0482510f2f5137951e9f2b31bb2353906d3621e4ee014bc12c73e33e23a87d4

See more details on using hashes here.

File details

Details for the file ovinc_client-0.4.13-py3-none-any.whl.

File metadata

  • Download URL: ovinc_client-0.4.13-py3-none-any.whl
  • Upload date:
  • Size: 40.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for ovinc_client-0.4.13-py3-none-any.whl
Algorithm Hash digest
SHA256 1d034ddf970cb6d7b14bd6614d7266c771d38f08c957470879a423dc58f587fd
MD5 0c7addef5d6515b21a8835d4e75c20c0
BLAKE2b-256 7c63f3e023334de7c6ff5fae0c686727ea125dcf5ba129eb87837d0ee1822777

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