Giter VIP home page Giter VIP logo

dingtalkchatbot's Issues

请问下at_dingtalk_ids的说明

通过outgoing能够获取到@方的dingtalkid ,无法获取手机号码,不能直接通过at_mobiles
但是通过 at_dingtalk_ids 好像不起作用.

初始化错误

xiaoding = DingtalkChatbot(webhook=webhook, secret=secret)
提示错误
xiaoding = DingtalkChatbot(webhook=webhook, secret=secret)
TypeError: init() got an unexpected keyword argument 'secret'

link['messageURL'] = self.msg_open_type(link['messageURL'])

cardItem = CardItem(title=title_list[element],
url=link_list[element],
pic_url=pic_list[element])

USE:
send_feed_card(cards)

ERROR:
File "C:\Users\AppData\Local\Programs\Python\Python38\lib\site-packages\dingtalkchatbot\chatbot.py", line 267, in send_feed_card
link['messageURL'] = self.msg_open_type(link['messageURL'])

python version 3.8.0
lib version 1.5.3

it all works fine until today, perhaps dingtalk offical did some changes?

钉钉机器人最大连接数

只开一个进程,结果今天发现钉钉机器人报错
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='oapi.dingtalk.com', port=443): Max retries exceeded with url: /robot/send?access_token=XX(token隐藏) (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000017F89A71C70>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

是钉钉更改了链接数了么?之前没问题的

求问:为什么会出现这种情况?

ERROR:root:消息发送失败,自动通知:{'msgtype': 'text', 'text': {'content': '钉钉机器人消息发送失败,原因:keywords not in content'}, 'at': {'isAtAll': True}}

我安装到linux7.2 不行啊

No package 'libffi' found
c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
[root@localhost DingtalkChatbot-master]# yum install python-devel

封装此模块的通用模块

这个模块相当好,但还需要再封装成一个通用的模块。代码dingRobotDev.py如下:直接运行此文件python3 dingRobotDev.py 即可运行demo的text模式,发送如果失败,有三次机会发送。不足之处请指正。

#!/usr/env/python3
#encoding=utf-8

from enum import Enum
import time
from dingtalkchatbot.chatbot import DingtalkChatbot
from contextlib import contextmanager
from contextlib import closing

class sendkind(Enum):
text = 't'
link = 'l'
image = 'i'
markdown = 'm'
action_card = 'a'
feed_card = 'f'

class dingRobot(object):
def init(self,webhook='YOURWEBHOOK',secret=None,pc_slide=None,kind=sendkind.text,
msgargs={'msg':'我就是小丁,小丁就是我!','is_at_all':True},retry=3,flag=True):
self.webhook=webhook
self.secret=secret
self.pc_slide=pc_slide
self.kind=kind
print(self.kind)
print(self.kind.value)
print(self.kind.name)
self.msgargs=msgargs
self.retry=retry
self.flag=flag
self.kw = {'secret':self.secret,'pc_slide':self.pc_slide}
#self.xiaoding = None
self.xiaoding = DingtalkChatbot(self.webhook,**self.kw)

def pushMsg(self):
    kindsendfunc = 'self.xiaoding.send_%s'%self.kind.name
    yield eval('%s(**self.msgargs)'%kindsendfunc)

def demo(self):
    for t in range(self.retry):
        time.sleep(4**t)
        with closing(self.pushMsg()) as push:
            print(push)
            for i in push:
                print('in for',i)
        print(i)
        if i['errcode']==0 and i['errmsg']=='ok':
            break

if name == 'main':
dingRobot().demo()

使用报错 URI TOO LARGE

经过检查代码,应该是self.webhook的问题,由于sign和timestamp的存在,导致每次post消息后,并没有把self.webhook恢复到原来的webhook,而是带上了上一次的timestamp和sign。最终多次发送消息后,导致url过长,钉钉拒绝接受消息。

希望大佬可以换个变量名,稍微改改。

'CardItem' is not defined

按照 https://github.com/zhuifengshen/DingtalkChatbot 里的example,为什么会报错?

sz@air:/mnt/d/coding$ python dd.py
Traceback (most recent call last):
  File "dd.py", line 65, in <module>
    card1 = CardItem(title="氧气美女", url="https://www.dingtalk.com/", pic_url="https://unzippedtv.com/wp-content/uploads/sites/28/2016/02/asian.jpg")
NameError: name 'CardItem' is not defined

有谁能指点下不?

证书验证失败

突然间就报错:SSL: CERTIFICATE_VERIFY_FAILED
在requests.post加了verify=False绕过去了,是否要把这个参数暴露出来?提升兼容性?还有更好的解决方案吗?

关于图片发送的问题

老哥好,我在尝试使用这个机器人发送图片。我发现如果使用本机图片路径好像不支持。我最近尝试先发送一个地址,15分钟后再上传图片好像不支持,消息都显示不出来图片。请问怎么解决这个问题呢?

有没兴趣开发个async版本的么

非常感谢分享
但在使用过程当中发现每次发完消息之后代码都卡住好久了,然后才发现原来是代码没用异步,
因此建议下大佬可以试试async

安装出错?

执行pip install DingtalkChatbot该命令后报错如下:
ERROR: Could not find a version that satisfies the requirement DingtalkChatbot ERROR: No matching distribution found for DingtalkChatbot

相关版本:
Python 3.6.8
Django 1.11.4

在SSH到的远程服务器上不能建立和钉钉机器人的http链接

我得到了钉钉机器人的webhook地址, 我需要在远程服务器上通过钉钉机器人向钉钉群发送消息,但是我发现并不能建立和钉钉机器人的连接,例如send_text()方法一直没有反应,最终提示connection time error.请问一下有解决方法吗

求助,如何添加钉钉机器人

楼主,请问钉钉群里不让加那个 webhook 的机器人,要如何获取你说的那个地址呢?
我的需求是:
在自己的服务器给某个钉钉群发一个图文消息或图片消息

Py的中文编码问题

用接口获取到文本信息后,在控制台是中文的,推送到企业微信是utf8编码而非中文,企业微信用的是utf8编码

hi,你好可以帮忙看看这个问题嘛HTTPSConnectionPool(host='oapi.dingtalk.com', port=443): Max retries exceeded with url: /robot/send?access_token=xxxxxxxxxxx (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)')))" 我在本地电脑上执行发送没问题,放在服务器上执行就报错了,可以帮忙看看嘛

hi,你好可以帮忙看看这个问题嘛,

HTTPSConnectionPool(host='oapi.dingtalk.com', port=443): Max retries exceeded with url: /robot/send?access_token=xxxxxxxxxxx (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)')))"

我在本地电脑上执行发送没问题,放在服务器上执行就报错了,可以帮忙看看嘛

HTTPSConnectionPool(host='oapi.dingtalk.com', port=443): Max retries exceeded with url: /robot/send?access_token=xxxxxxxxxxxxxx (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)')))"

HTTPSConnectionPool(host='oapi.dingtalk.com', port=443): Max retries exceeded with url: /robot/send?access_token=xxxxxxxxxxxxxx (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)')))"

我在本地电脑上执行发送没问题,放在服务器上执行就报错了,可以帮忙看看嘛

没法艾特所有人了

大佬你好,我最近在使用 DingtalkChatbot,目前在研究 Markdown 的方式来发消息
本来发送的好好的,也能艾特所有人,但是我看了一下参数,有个 is_auto_at 这个参数,我手欠给设置成了 False
之后再取消掉这个参数,即便设置了 at_mobiles 也不是蓝色的艾特,系统也不会弹窗提示。把 is_auto_at 参数设置成 True 后,依旧不会蓝字,钉钉界面里有提示自己被艾特了,但是依旧不会弹窗提示
想问一下这该怎么解决???

用户发消息到服务端后,回复用户时如何实现@功能

at_dingtalk_ids = ["xxx"]
xiaoding.send_markdown(title='氧气文字', text='#### 广州天气 @xxx \n'
'> 9度,西北风1级,空气良89,相对温度73%\n\n'
'> 美景\n'
'> ###### 10点20分发布 天气 \n',
at_dingtalk_ids=at_dingtalk_ids, is_auto_at=False)

这样使用无效,userId应该如何获取呢?
我暂时从用户post的消息里拿了atUsers里的dingtalkId字段

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.