Merge pull request #27 from cwiki-us-docs/naming_rules

Naming rules
This commit is contained in:
YuCheng Hu 2021-03-23 10:35:41 -04:00 committed by GitHub
commit 63aedf01e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 90 additions and 6 deletions

View File

@ -3,5 +3,8 @@ yfinance==0.1.54
python-dateutil~=2.8.1
setuptools~=54.0.0
ruamel.yaml
qrcode
qrcode~=6.1
Pillow
pyautogui
selenium
requests

46
tests/PyAutoGUICursor.py Normal file
View File

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
# Python Random String Password
# Author - HoneyMoose(huyuchengus@gmail.com)
# Link Article - https://www.ossez.com/t/python-pyautogui/13400
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(10)
pyautogui.click(x=200, y=400)
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)

View File

@ -2,10 +2,10 @@
# 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
import random
def random_password(length, printable):
@ -15,14 +15,13 @@ 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__":
3
print(__name__)
amount = int(input("请输入需要生成随机字符串的数量: "))
number = int(input("请输入随机字符串的长度: "))
@ -32,3 +31,16 @@ 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))} ")
# choices Function Test
print('')
my_list = ["apple", "banana", "cherry"]
print(random.choices(my_list, weights=[10, 1, 1], k=12))

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Python Email Sending Test
# Author - HoneyMoose(huyuchengus@gmail.com)
# Link Article - https://www.ossez.com/t/python-api/13402
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 <huyuchengus@gmail.com>",
"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)