Skip to main content

Install

pip3 install ccdingtalk --upgrade --user

Send Message using CCDingTalkWebhookMessage

from ccdingtalk import CCDingTalkWebhookMessage

chat_bot = CCDingTalkWebhookMessage(webhook_url)
r = chat_bot.send_text(msg=msg, at_mobiles=at_mobiles)

Send with several webhooks (auto load balance) using CCDingTalkWebhookMessageQueue

from ccdingtalk import CCDingTalkWebhookMessageQueue

def __webhook_urls() -> list:
    api = 'https://oapi.dingtalk.com/robot/send?access_token='
    tokens = [
        'token1',
        'token2',
        'token3',
        'token4',
        'token5',
    ]
    results = []
    for token in tokens:
        results.append(api + token)
    return results


__shared_msg_queue = CCDingTalkWebhookMessageQueue(__webhook_urls())


def send_ding_msg(msg: str, at_mobile=''):
    __shared_msg_queue.add_message(msg, [at_mobile])

Reply Message using CCDingTalkReply

from ccdingtalk import CCDingTalkReply

class DingBotRequestHandler(BaseHTTPRequestHandler):

    def do_GET(self):
		response = CCDingTalkReply.text_msg("This is GET request")
		response_bytes = response.encode()
		self.send_header("Content-Type", "text/html; charset=utf-8")
		self.send_header("Content-Length", str(len(response_bytes)))
		self.end_headers()
		self.wfile.write(response_bytes)

    def do_POST(self):
		response = CCDingTalkReply.text_msg("This is POST request")
		response_bytes = response.encode()
		self.send_header("Content-Type", "text/html; charset=utf-8")
		self.send_header("Content-Length", str(len(response_bytes)))
		self.end_headers()
		self.wfile.write(response_bytes)

Metadata

Release files for ccdingtalk 1.5

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

Source distribution (sdist)

Source distribution for ccdingtalk 1.5
File Size Uploaded Provenance
ccdingtalk-1.5.tar.gz 5.7 kB Without provenance Details

Release files / ccdingtalk-1.5.tar.gz

Download URL ccdingtalk-1.5.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
279716eb3c520356d06c92d326d6e2c64a06070175380ae3abe49ca6a79602b0
BLAKE2b-256 checksum
How to use checksums
a8c5e50a33c07c89cb2d42ba97671af267577b6634447a7d53b5bba262e09426
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.9

Security for ccdingtalk 1.5

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