From c3fdd5ac0218ba674fa70f31206c72a7481ee3c7 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Fri, 19 Mar 2021 09:39:22 -0400 Subject: [PATCH 1/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=9A=8F=E6=9C=BA?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E7=94=9F=E6=88=90=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/RandomStringGenerate.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/RandomStringGenerate.py b/tests/RandomStringGenerate.py index f7b9ac5..c5de637 100644 --- a/tests/RandomStringGenerate.py +++ b/tests/RandomStringGenerate.py @@ -2,7 +2,7 @@ # Python Random String Password # Author - HoneyMoose(huyuchengus@gmail.com) -# Link Article - https://www.ossez.com/c/open-source/python/14 +# Link Article - https://www.ossez.com/t/python/13398 import string from random import choice @@ -22,7 +22,6 @@ if __name__ == "__main__": 3 print(__name__) - amount = int(input("请输入需要生成随机字符串的数量: ")) number = int(input("请输入随机字符串的长度: ")) @@ -32,3 +31,11 @@ for i in range(1, amount + 1): print('') for i in range(1, amount + 1): print(f" 随机字符串 [Ascii Uppercase String]: {i} - {repr(random_password(number, string.ascii_uppercase))} ") + +print('') +for i in range(1, amount + 1): + print(f" 随机字符串 [Ascii Lowercase String]: {i} - {repr(random_password(number, string.ascii_lowercase))} ") + +print('') +for i in range(1, amount + 1): + print(f" 随机字符串 [Ascii Digits String]: {i} - {repr(random_password(number, string.digits))} ") From 2ea753ac1d5f76e78371775dbebd13ade5be4762 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Fri, 19 Mar 2021 11:05:07 -0400 Subject: [PATCH 2/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BD=BF=E7=94=A8=20choi?= =?UTF-8?q?ces=20=20=E5=87=BD=E6=95=B0=E7=9A=84=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/RandomStringGenerate.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/RandomStringGenerate.py b/tests/RandomStringGenerate.py index c5de637..b158f7b 100644 --- a/tests/RandomStringGenerate.py +++ b/tests/RandomStringGenerate.py @@ -5,7 +5,7 @@ # Link Article - https://www.ossez.com/t/python/13398 import string -from random import choice +import random def random_password(length, printable): @@ -15,7 +15,7 @@ def random_password(length, printable): :param int length: 生成随机字符串的数量 """ - return "".join([choice(printable) for x in range(int(length))]) + return "".join([random.choice(printable) for x in range(int(length))]) if __name__ == "__main__": @@ -39,3 +39,8 @@ for i in range(1, amount + 1): print('') for i in range(1, amount + 1): print(f" 随机字符串 [Ascii Digits String]: {i} - {repr(random_password(number, string.digits))} ") + +# choices Function Test +print('') +my_list = ["apple", "banana", "cherry"] +print(random.choices(my_list, weights=[10, 1, 1], k=12)) From e5eabb0a17421e5e8b2b90c775adfe96f59142ef Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Sat, 20 Mar 2021 10:09:47 -0400 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20PyAutoGUICursor=20?= =?UTF-8?q?=E6=9D=A5=E5=AF=B9=E9=BC=A0=E6=A0=87=E5=92=8C=E9=94=AE=E7=9B=98?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 3 ++- tests/PyAutoGUICursor.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 tests/PyAutoGUICursor.py diff --git a/requirements.txt b/requirements.txt index ed217ea..b4ec155 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ python-dateutil~=2.8.1 setuptools~=54.0.0 ruamel.yaml qrcode -Pillow \ No newline at end of file +Pillow +pyautogui \ No newline at end of file diff --git a/tests/PyAutoGUICursor.py b/tests/PyAutoGUICursor.py new file mode 100644 index 0000000..a92de72 --- /dev/null +++ b/tests/PyAutoGUICursor.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +# Python Random String Password +# Author - HoneyMoose(huyuchengus@gmail.com) +# Link Article - https://www.ossez.com/t/python/13398 + +import time + +import pyautogui + +while True: + # 移动鼠标,duration=0.1是鼠标移动过程中的延迟速度 + pyautogui.moveTo(x=300, y=300, duration=0.1) + time.sleep(3) + + # 移动鼠标到坐标后,单击左键 + pyautogui.click(x=700, y=300, duration=0.1) + time.sleep(3) + + # 移动鼠标到坐标后,双击左键 + pyautogui.doubleClick(x=600, y=300, duration=0.1) + time.sleep(3) + + # 移动鼠标到坐标后,单击右键 + pyautogui.rightClick(x=700, y=300, duration=0.1) + time.sleep(3) + + pyautogui.click(x=100, y=200) + time.sleep(3) + + pyautogui.click(x=200, y=400) + time.sleep(3) From 21329f72ccaf6943ec8b35183020a95af8e71b99 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Sat, 20 Mar 2021 11:45:30 -0400 Subject: [PATCH 4/7] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=94=BB=E5=9B=BE?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/PyAutoGUICursor.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/PyAutoGUICursor.py b/tests/PyAutoGUICursor.py index a92de72..59bb372 100644 --- a/tests/PyAutoGUICursor.py +++ b/tests/PyAutoGUICursor.py @@ -2,7 +2,7 @@ # Python Random String Password # Author - HoneyMoose(huyuchengus@gmail.com) -# Link Article - https://www.ossez.com/t/python/13398 +# Link Article - https://www.ossez.com/t/python-pyautogui/13400 import time @@ -26,7 +26,21 @@ while True: time.sleep(3) pyautogui.click(x=100, y=200) - time.sleep(3) + time.sleep(10) pyautogui.click(x=200, y=400) - time.sleep(3) + time.sleep(10) + + # 可以在 Windows 中打开 Paint,然后执行下面的语句 + distance = 200 + while distance > 0: + pyautogui.drag(distance, 0, duration=0.5) # move right + distance -= 5 + pyautogui.drag(0, distance, duration=0.5) # move down + pyautogui.drag(-distance, 0, duration=0.5) # move left + distance -= 5 + pyautogui.drag(0, -distance, duration=0.5) # move up + time.sleep(10) + + + From 625a0e841260dd29ccce19f8b48755486ddacd93 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Mon, 22 Mar 2021 12:20:14 -0400 Subject: [PATCH 5/7] Email Test --- requirements.txt | 3 ++- tests/SendMail.py | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/SendMail.py diff --git a/requirements.txt b/requirements.txt index b4ec155..f49995a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,5 @@ setuptools~=54.0.0 ruamel.yaml qrcode Pillow -pyautogui \ No newline at end of file +pyautogui +selenium \ No newline at end of file diff --git a/tests/SendMail.py b/tests/SendMail.py new file mode 100644 index 0000000..b9444ff --- /dev/null +++ b/tests/SendMail.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# Python Email Sending Test +# Author - HoneyMoose(huyuchengus@gmail.com) +# Link Article - https://www.ossez.com/t/python/13398 + +import requests + + +# MAILGUN API SEND MESSAGE +def mailgun_api_send_message(): + return requests.post( + "https://api.mailgun.net/v3/sandbox7955c7c533744fb28e650b72192eac87.mailgun.org", + auth=("api", "YOUR_API_KEY"), + data={"from": "OSSEZ ", + "to": ["huyuchengus@gmail.com"], + "subject": "Hello MailGun API", + "text": "Testing Sending mail by Mailgun API!"}) + + +if __name__ == "__main__": + for i in range(3): + print(mailgun_api_send_message().text) From 36f46a245976963e5e22e63c214a507ddd75dee0 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Mon, 22 Mar 2021 16:21:57 -0400 Subject: [PATCH 6/7] =?UTF-8?q?=E9=82=AE=E4=BB=B6=20API=20=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=8F=91=E9=80=81=20API=20=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 7 ++++--- tests/{SendMail.py => SendMailRESTfulAPI.py} | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) rename tests/{SendMail.py => SendMailRESTfulAPI.py} (91%) diff --git a/requirements.txt b/requirements.txt index f49995a..4cdc7cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,8 @@ yfinance==0.1.54 python-dateutil~=2.8.1 setuptools~=54.0.0 ruamel.yaml -qrcode +qrcode~=6.1 Pillow -pyautogui -selenium \ No newline at end of file +pyautogui~=0.9.52 +selenium +requests~=2.25.1 \ No newline at end of file diff --git a/tests/SendMail.py b/tests/SendMailRESTfulAPI.py similarity index 91% rename from tests/SendMail.py rename to tests/SendMailRESTfulAPI.py index b9444ff..f1705ce 100644 --- a/tests/SendMail.py +++ b/tests/SendMailRESTfulAPI.py @@ -2,7 +2,7 @@ # Python Email Sending Test # Author - HoneyMoose(huyuchengus@gmail.com) -# Link Article - https://www.ossez.com/t/python/13398 +# Link Article - https://www.ossez.com/t/python-api/13402 import requests From 2b0e7f0c9a7fad0ec9ee3531ca2f0a62417ed2e8 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Mon, 22 Mar 2021 16:22:35 -0400 Subject: [PATCH 7/7] =?UTF-8?q?=E9=92=88=E5=AF=B9=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E6=A8=A1=E5=9D=97=E4=B8=8D=E6=8C=87=E5=AE=9A=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E7=9A=84=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4cdc7cb..d035d62 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,6 @@ setuptools~=54.0.0 ruamel.yaml qrcode~=6.1 Pillow -pyautogui~=0.9.52 +pyautogui selenium -requests~=2.25.1 \ No newline at end of file +requests \ No newline at end of file