forked from hanfangyuan4396/dify-on-wechat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: supports gewechat login (hanfangyuan4396#145)
- Loading branch information
1 parent
669bd83
commit 9fbb1c4
Showing
6 changed files
with
216 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import qrcode | ||
|
||
def print_green(text): | ||
print(f"\033[32m{text}\033[0m") | ||
|
||
def print_yellow(text): | ||
print(f"\033[33m{text}\033[0m") | ||
|
||
def print_red(text): | ||
print(f"\033[31m{text}\033[0m") | ||
|
||
def make_and_print_qr(url): | ||
"""生成并打印二维码 | ||
Args: | ||
url: 需要生成二维码的URL字符串 | ||
Returns: | ||
None | ||
功能: | ||
1. 在终端打印二维码的ASCII图形 | ||
2. 同时提供在线二维码生成链接作为备选 | ||
""" | ||
print_green("请扫描下方二维码登录") | ||
qr = qrcode.QRCode() | ||
qr.add_data(url) | ||
qr.make() | ||
qr.print_ascii(invert=True) | ||
print_green(f"也可以访问下方链接获取二维码:\nhttps://api.qrserver.com/v1/create-qr-code/?data={url}") | ||
|