Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

通过机器人推送至钉钉之后,推送消息没有显示登录二维码 #108

Open
zeroneiko opened this issue May 22, 2021 · 12 comments

Comments

@zeroneiko
Copy link

系统版本,包含位数:Windows10 64bit Professional

python版本: Python 3.7.9

软件/源码版本:TechXueXi-20210521

浏览器、驱动版本:ChromeDriver 73.0.3683.68
Google Chrome 73.0.3683.86


详细描述

答:通过机器人推送至钉钉之后,推送消息没有显示登录二维码

WSFWDMP@FSVCAE(Y}ALXJPO

@QDcvd
Copy link

QDcvd commented May 22, 2021

请问大佬是怎么接入钉钉机器人的,我在main.ini那里看不太明白

@xuhn
Copy link

xuhn commented May 22, 2021

消息打开以后,里面是什么

@zeroneiko
Copy link
Author

消息打开以后,里面是什么

只是一个空消息,没有任何内容

@zeroneiko
Copy link
Author

请问大佬是怎么接入钉钉机器人的,我在main.ini那里看不太明白

_WJ66BT2}M_DN{0)1ZC7}II

@zeroneiko
Copy link
Author

请问大佬是怎么接入钉钉机器人的,我在main.ini那里看不太明白

把注释去掉,开关从0改成一,照链接里申请Token和secret,填写进去就能接入

@xuhn
Copy link

xuhn commented May 23, 2021

消息打开以后,里面是什么

只是一个空消息,没有任何内容
image
麻烦在mydriver.py里的,def getQRcode(self)这个函数中,把path打印下,看有没有,因为我只有linux和mac环境,没有windows环境,所以也没办法复现。

@zeroneiko
Copy link
Author

zeroneiko commented May 23, 2021

消息打开以后,里面是什么

只是一个空消息,没有任何内容
image
麻烦在mydriver.py里的,def getQRcode(self)这个函数中,把path打印下,看有没有,因为我只有linux和mac环境,没有windows环境,所以也没办法复现。

能获取到二维码地址,path也有值,在pandalearning.py中,运行结果如下:

============================================================
科技强国官方网站:https://techxuexi.js.org
Github地址:https://github.com/TechXueXi
使用本项目,必须接受以下内容,否则请立即退出:
- TechXueXi 仅额外提供给“爱党爱国”且“工作学业繁重”的人
- 项目开源协议 LGPL-3.0
- 不得利用本项目盈利
另外,我们建议你参与一个维护劳动法的项目:
https://996.icu/https://github.com/996icu/996.ICU/blob/master/README_CN.md

默认用户ID:0,默认用户昵称:default 【无有效cookie信息,需要登录】

TechXueXi 现支持以下模式(答题时请值守电脑旁处理少部分不正常的题目):

1 文章+视频
2 文章+视频+每日答题
(可以根据当日已得做题积分,决定是否做题)
3 文章+视频+每日答题+每周答题+专项答题
(可以根据当日已得做题积分,及是否有可得分套题,决定是否做题)

默认选择模式:3

开启: 获取更新信息...
[*] 正在联网获取更新信息...(更新显示不会打断之前输入等操作)
未找到有效登录信息,需要登录

DevTools listening on ws://127.0.0.1:49998/devtools/browser/84f2c745-5408-4d96-841f-6875e9b22818
[] TechXueXi最新下载地址为 https://github.com/TechXueXi/TechXueXi
[
] 程序版本为:v20210521
[*] 最新版本为:v20210521
正在打开二维码登陆界面,请稍后
二维码将发往钉钉机器人...

获取二维码地址: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANIAAADSCAYAAAA/mZ5CAAAU7klEQVR4Xu3d4XrbvA4D4O7+L3rnadPt7Evk+A1Mp+mG/R1FUSBAUo6b/Hh7e/v59sX/fv6cC+HHjx+7p9H9rn2t1iU27wFKDKuzyLoVAILLLnAbBikusp9icOb5KM4KaRumRCRCqgpJqHmxqZAcK6rO6k4qk1b1CslQl+KhmF/vWCFZDj6sUpDTEUb3q5AsiRXS29v7hWLugmK431gpscV9O9IaJcFF8F3ZVEgbQpokdtqqZZ0kXpI82RWVsIKx+rrGQc+crrv2L3HKeVd3orPXCYdk8ll2JA0+CUJn3gppfdEWzCuk2etChbRx/0rFLCSW6qwdUH2lnSVd1450W+TakT7ZNNWFlfyyn/pKBZGuq5AqpA/utCOte6uOhBXSASFNVUclsewniRebyVFLOo2MiGqjeIo/wVyxkjuu5EbxTD6qEEy2znu9H492CvLeuKCJl/3SRGgMQoa982qyUrv0LHKB3opJyf3neo1TBCGxCzcUc/FVIT1wR0rFrQlL7JSg4lvO1450QbId6cAdSYiWVGsh+ZZNhbQmtnQRxV18/ZMdSUaDlY2IRI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CgBQrwVNEIjZHCkWa0wrpgbuUgHxtMylc9dWO9PUPb5Z3pIRAR9Z0tFujVyH5545fPdr9D5HAO2QV/ayqAAAAAElFTkSuQmCC
钉钉机器人url:

@shikik
Copy link

shikik commented May 30, 2021

同样也是这个问题。

@mudapi
Copy link

mudapi commented Jun 5, 2021

dingding.py的开头加上
import re
import base64
from io import BytesIO

from pyzbar.pyzbar import decode
from PIL import Image

def base64_to_image(base64_str, image_path=None):
base64_data = re.sub('^data:image/.+;base64,', '', base64_str)
byte_data = base64.b64decode(base64_data)
image_data = BytesIO(byte_data)
img = Image.open(image_data)
if image_path:
img.save(image_path)
return img

后面的def改成
def ddmsgsend(self, msgurl):
import requests, json # 导入依赖库
img=base64_to_image(msgurl)
barcodes = decode(img)
for barcode in barcodes:
url = barcode.data.decode("utf-8")
headers = {"Content-Type": "application/json ; charset=utf-8"} # 定义数据类型
data = {
"text": {
"content": url,
},
"msgtype": "text"
}
res = requests.post(self.get_url(), data=json.dumps(data), headers=headers)
#发送post请求
print(res.text)

最后收到的链接就是登陆链接,复制到学习强国里面发给自己,然后打开链接就行

@zeroneiko
Copy link
Author

dingding.py的开头加上
import re
import base64
from io import BytesIO

from pyzbar.pyzbar import decode
from PIL import Image

def base64_to_image(base64_str, image_path=None):
base64_data = re.sub('^data:image/.+;base64,', '', base64_str)
byte_data = base64.b64decode(base64_data)
image_data = BytesIO(byte_data)
img = Image.open(image_data)
if image_path:
img.save(image_path)
return img

后面的def改成
def ddmsgsend(self, msgurl):
import requests, json # 导入依赖库
img=base64_to_image(msgurl)
barcodes = decode(img)
for barcode in barcodes:
url = barcode.data.decode("utf-8")
headers = {"Content-Type": "application/json ; charset=utf-8"} # 定义数据类型
data = {
"text": {
"content": url,
},
"msgtype": "text"
}
res = requests.post(self.get_url(), data=json.dumps(data), headers=headers)
#发送post请求
print(res.text)

最后收到的链接就是登陆链接,复制到学习强国里面发给自己,然后打开链接就行

大佬求问
“def base64_to_image(base64_str, image_path=None):
base64_data = re.sub('^data:image/.+;base64,', '', base64_str)
byte_data = base64.b64decode(base64_data)
image_data = BytesIO(byte_data)
img = Image.open(image_data)
if image_path:
img.save(image_path)
return img”
这段代码是插在哪里呢?

@zhaozhiming
Copy link

同样的问题 + 1,发送的是一个登陆二维码的图片data数据,但没法通过钉钉机器人发送图片

wx5223 referenced this issue in wx5223/TechXueXi Jun 16, 2021
based on TechXueXi/TechXueXi#108 (thanks to mudapi)
2、加入登录自动超时重试(重试2次)
3、加入超时退出(针对部分答题问题导致程序挂起)
4、去除docker容器配置文件,简化使用(现在只需要一条命令即可)
@wx5223 wx5223 mentioned this issue Jun 16, 2021
4 tasks
@afirmware
Copy link

我现在在用Windows版的每天还需要扫一下码有点麻烦,这个二维码发过来之后,有没有办法自动让学习强国App扫并确认登陆?以便实现完全自动化

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants