Re: [問題] 帳號密碼加密
我自己回答一下好了
使用EZGmailhttps://pypi.org/project/EZGmail/
搭配gmail的api很快就可以完成這個需求
https://developers.google.com/gmail/api/quickstart/python
先從google上產生credentials.json並下載後
安裝Google Client Libray
pip install --upgrade google-api-python-client google-auth-httplib2
google-auth-oauthlib
接下來複製下面quickstart.py 並執行 python quickstart.py
會將下載的credentials.json 再產生兩個token檔案
token.json token.pickle
接下來透過EZGmail搭配產生的token就可以寄送郵件
而不需要在程式內打上任何的帳號密碼
附件、bcc、cc都可以輕鬆做到
完整範例:
https://github.com/draguitar/Gmail-API-Send
※ 引述《ctr1 (【積π】)》之銘言:
: 想藉gmail寄送郵件
: 程式內需要輸入帳密
: 但由於程式需要放在共用的電腦
: https://i.imgur.com/aYDeHLR.jpg

: 想請問該如何把圖中
: gmail_user、gmail_password的部分加密
: 讓別人無法從source code中看到帳密資訊
: 謝謝~
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 210.242.44.65 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1577263985.A.FB7.html
→
12/25 17:28,
5年前
, 1F
12/25 17:28, 1F
→
12/25 17:29,
5年前
, 2F
12/25 17:29, 2F
推
12/25 19:42,
5年前
, 3F
12/25 19:42, 3F
推
12/25 19:51,
5年前
, 4F
12/25 19:51, 4F
→
12/25 19:51,
5年前
, 5F
12/25 19:51, 5F
→
12/25 19:54,
5年前
, 6F
12/25 19:54, 6F
→
12/25 19:56,
5年前
, 7F
12/25 19:56, 7F
→
12/25 19:57,
5年前
, 8F
12/25 19:57, 8F
推
12/26 08:26,
5年前
, 9F
12/26 08:26, 9F
→
12/26 08:26,
5年前
, 10F
12/26 08:26, 10F
→
12/27 00:14,
5年前
, 11F
12/27 00:14, 11F
→
12/27 00:14,
5年前
, 12F
12/27 00:14, 12F
→
12/27 08:32,
5年前
, 13F
12/27 08:32, 13F
→
12/27 15:35,
5年前
, 14F
12/27 15:35, 14F
→
12/27 15:36,
5年前
, 15F
12/27 15:36, 15F
推
12/31 17:44,
5年前
, 16F
12/31 17:44, 16F
討論串 (同標題文章)
Python 近期熱門文章
PTT數位生活區 即時熱門文章