Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Elij4h
netease-cloud
提交
3526172d
N
netease-cloud
项目概览
Elij4h
/
netease-cloud
与 Fork 源项目一致
Fork自
ZainCheung / netease-cloud
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
netease-cloud
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3526172d
编写于
9月 08, 2020
作者:
ZainCheung
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复云函数
上级
19eecf44
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
260 addition
and
260 deletion
+260
-260
index.py
index.py
+260
-260
未找到文件。
index.py
浏览文件 @
3526172d
#coding:utf-8
'''
@author: ZainCheung
@LastEditors: ZainCheung
@description:网易云音乐全自动每日打卡云函数版
@Date: 2020-06-25 14:28:48
@LastEditTime: 2020-09-01 18:20:00
'''
from
configparser
import
ConfigParser
from
threading
import
Timer
import
requests
import
random
import
hashlib
import
datetime
import
time
import
json
import
logging
import
math
#coding:utf-8
'''
@author: ZainCheung
@LastEditors: ZainCheung
@description:网易云音乐全自动每日打卡云函数版
@Date: 2020-06-25 14:28:48
@LastEditTime: 2020-09-01 18:20:00
'''
from
configparser
import
ConfigParser
from
threading
import
Timer
import
requests
import
random
import
hashlib
import
datetime
import
time
import
json
import
logging
import
math
logger
=
logging
.
getLogger
()
grade
=
[
10
,
40
,
70
,
130
,
200
,
400
,
1000
,
3000
,
8000
,
20000
]
api
=
''
logger
=
logging
.
getLogger
()
grade
=
[
10
,
40
,
70
,
130
,
200
,
400
,
1000
,
3000
,
8000
,
20000
]
api
=
''
class
Task
(
object
):
class
Task
(
object
):
'''
对象的构造函数
...
...
@@ -196,11 +196,11 @@
self
.
log
(
'用户:'
+
self
.
name
+
' 今日任务已完成'
)
'''
初始化:读取配置,配置文件为init.config
返回字典类型的配置对象
'''
def
init
():
'''
初始化:读取配置,配置文件为init.config
返回字典类型的配置对象
'''
def
init
():
global
api
# 初始化时设置api
config
=
ConfigParser
()
config
.
read
(
'init.config'
,
encoding
=
'UTF-8-sig'
)
...
...
@@ -223,29 +223,29 @@
}
return
conf
'''
MD5加密
str:待加密字符
返回加密后的字符
'''
def
md5
(
str
):
'''
MD5加密
str:待加密字符
返回加密后的字符
'''
def
md5
(
str
):
hl
=
hashlib
.
md5
()
hl
.
update
(
str
.
encode
(
encoding
=
'utf-8'
))
return
hl
.
hexdigest
()
'''
加载Json文件
jsonPath:json文件的名字,例如account.json
'''
def
loadJson
(
jsonPath
):
'''
加载Json文件
jsonPath:json文件的名字,例如account.json
'''
def
loadJson
(
jsonPath
):
with
open
(
jsonPath
,
encoding
=
'utf-8'
)
as
f
:
account
=
json
.
load
(
f
)
return
account
'''
检查api
'''
def
check
():
'''
检查api
'''
def
check
():
url
=
api
+
'?do=check'
respones
=
requests
.
get
(
url
)
if
respones
.
status_code
==
200
:
...
...
@@ -253,10 +253,10 @@
else
:
logger
.
error
(
'api测试异常'
)
'''
任务池
'''
def
taskPool
():
'''
任务池
'''
def
taskPool
():
config
=
init
()
check
()
# 每天对api做一次检查
...
...
@@ -277,8 +277,8 @@
task
=
Task
(
config
[
'uin'
],
config
[
'pwd'
],
config
[
'sckey'
],
config
[
'countrycode'
])
task
.
start
()
'''
程序的入口
'''
def
main
(
event
,
content
):
'''
程序的入口
'''
def
main
(
event
,
content
):
taskPool
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录