upload via files

This commit is contained in:
RTAkland
2021-11-11 21:23:15 +08:00
parent 7e1b466ce5
commit 54b695cf0e
197 files changed
+301

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
*.yml
!config.yml
*.token
*.zip
**/__pycache__
/.idea/
venv/
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python
# -- coding:utf-8 --
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2021/10/31
# @File Name: API_24hour_weathers.py
"""
获取未来24小时时级天气预报 (24)
启用等级: DEV
"""
import requests
import json
def hourly_weather(location: int, key: str, lang: str = 'zh', unit: str = 'm'):
r = requests.get(
f'https://devapi.qweather.com/v7/weather/24h?location={location}&key={key}&lang={lang}&unit={unit}')
data = json.loads(r.text)
status_code = data['code']
updateTime = str(data['updateTime'][:-6]).replace('T', '')
main_data = data['hourly'] # 24
return status_code, updateTime, main_data
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python
# -- coding:utf-8 --
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2021/10/31
# @File Name: API_indices.py
"""
获取生活建议的API
获取所有生活建议 (15+)
启用等级: DEV
"""
import requests
import json
def indices(location: int, key: str, lang: str = 'zh', unit: str = 'm'):
r = requests.get(
f'https://devapi.qweather.com/v7/indices/1d?type=0&location={location}&key={key}&lang={lang}&unit={unit}')
data = json.loads(r.text)
status_code = data['code']
updateTime = str(data['updateTime'][:-6]).replace('T', '')
main_data = data['daily'] # 1-15(+)
return status_code, updateTime, main_data
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2021/9/29
# @File Name: API_get_warning_list.py:
"""
开发版key使用此API可以快速返回正在预警的城市id
Only Dev-mode
"""
import requests
import json
from ruamel.yaml import YAML
def get_warning_list(_range='cn'):
yaml = YAML()
with open('./config.yml', 'r', encoding='utf-8') as f:
config = yaml.load(f.read())
key = config['request-settings']['key']
session = requests.Session()
session.trust_env = False
r = session.get(f'https://devapi.qweather.com/v7/warning/list?range={_range}&key={key}')
_data = json.loads(r.text)
return _data['code'], _data['warningLocList'][0]['locationId']
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2021/9/29
# @File Name: API_real_time_air_quality.py
"""
开发版key获取实时空气质量
only: Dev-mode
"""
import requests
import json
import sys
from ruamel.yaml import YAML
def real_time_air_quality():
yaml = YAML()
with open(sys.path[1] + '/config.yml', 'r', encoding='utf-8') as f:
config = yaml.load(f.read())
mode = config['request-settings']['mode']
key = config['request-settings']['key']
location = config['request-settings']['location']
unit = config['request-settings']['unit']
lang = config['request-settings']['lang']
if mode != 'dev':
return False, print('Only Dev-mode')
session = requests.Session()
session.trust_env = False
r = session.get(f'https://devapi.qweather.com/v7/air/now?'
f'location={location}config.yml&key={key}&lang={lang}&unit={unit}&gzip=y')
_data = json.loads(r.text)
return _data['code'], _data['now']
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2021/10/16
# @File Name: __init__.py
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

+39
View File
@@ -0,0 +1,39 @@
{
"request_result_weather": "Weather API request result",
"request_result_indices": "Indices request result",
"request_result_warning": "Warning API request result",
"indices_tip": "No indices",
"mail_error": "Mail sending error Error reason",
"running": "Running Send mode",
"send_time": "Send time",
"mail_succeed": "Mail sending succeed.",
"config_not_filled": "Config file has no filled item(s).",
"statement_1": "Do not modify the configuration file at will.",
"statement_2": "All requests for this project are made using the local network.",
"statement_3": "If you used a VPN or PROXY, it will doesn't work.",
"statement_4": "If you have seen this message, the program runs normally.",
"debug_done": "Execution completed.",
"new_warning": "Get new disaster warning",
"warning_updated": "Disaster warning has been updated",
"area": "Area",
"weather": "Weather",
"sender": "Sender Account",
"date": "Date",
"lowestTemp": "LowestTemp",
"highestTemp": "HighestTemp",
"wind_info": "WindSpeed/Level/Dir",
"humidity": "Humidity",
"uv_info": "UV",
"vis": "Visibility",
"pressure": "Pressure",
"cloud": "Cloud",
"subject_7": "7 Day's weather report",
"subject_3": "3 Day's weather report",
"subject_war": "Natural disaster warning",
"release_time": "Release time",
"early_warning": "Early warning",
"warning_status": "Warning status",
"warning_type": "Warning type",
"warning_duration": "Duration",
"wait_seconds": "Wait 61 seconds..."
}
+39
View File
@@ -0,0 +1,39 @@
{
"request_result_weather": "天气信息请求结果",
"request_result_indices": "生活建议请求结果",
"request_result_warning": "自然灾害API请求结果",
"indices_tip": "无具体描述",
"mail_error": "邮件发送错误 错误原因",
"running": "运行中 发送模式",
"send_time": "发送时间",
"mail_succeed": "邮件发送成功",
"config_not_filled": "配置文件填写错误",
"statement_1": "配置文件请不要随意修改",
"statement_2": "本项目所有程序均使用本地网络进行请求",
"statement_3": "如果使用了VPN或代理将不会生效",
"statement_4": "如果你看到这段话就说明程序在正常运行",
"debug_done": "执行完成",
"new_warning": "获取到新的灾害预警",
"warning_updated": "灾害预警信息已更新",
"area": "地区",
"weather": "天气",
"sender": "发送者账号",
"date": "日期",
"lowestTemp": "最低气温",
"highestTemp": "最高气温",
"wind_info": "风速/级/向",
"humidity": "空气湿度",
"uv_info": "紫外线强度",
"vis": "能见度",
"pressure": "气压",
"cloud": "云量",
"subject_7": "7天天气预报",
"subject_3": "3天天气预报",
"subject_war": "自然灾害预报",
"release_time": "发布时间",
"early_warning": "预警",
"warning_status": "灾害状态",
"warning_type": "灾害类型",
"warning_duration": "持续时间",
"wait_seconds": "等待61秒..."
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Loaded 100 of 197 files, more files were not shown because too many files have changed in this diff. Show more