Skip to content

Commit df7a2af

Browse files
authored
Update 1.py
1 parent 73eb15e commit df7a2af

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

1.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: UTF-8 -*-
22
import requests as req
3-
import json,sys,time,random
3+
import json,sys,time
44
#先注册azure应用,确保应用有以下权限:
55
#files: Files.Read.All、Files.ReadWrite.All、Sites.Read.All、Sites.ReadWrite.All
66
#user: User.Read.All、User.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All
@@ -13,7 +13,6 @@
1313

1414

1515
path=sys.path[0]+r'/1.txt'
16-
path2=sys.path[0]+r'/time.log'
1716
num1 = 0
1817

1918
def gettoken(refresh_token):
@@ -35,10 +34,7 @@ def gettoken(refresh_token):
3534
def main():
3635
fo = open(path, "r+")
3736
refresh_token = fo.read()
38-
fo.close()
39-
fv = open(path2, "r+")
40-
timelog = fv.read()
41-
fv.close()
37+
fo.close()
4238
global num1
4339
localtime = time.asctime( time.localtime(time.time()) )
4440
access_token=gettoken(refresh_token)
@@ -65,7 +61,7 @@ def main():
6561
if req.get(r'https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messageRules',headers=headers).status_code == 200:
6662
num1+=1
6763
print('6调用成功'+str(num1)+'次')
68-
if req.get(r'https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messageRules',headers=headers).status_code == 200:
64+
if req.get(r'https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages/delta',headers=headers).status_code == 200:
6965
num1+=1
7066
print('7调用成功'+str(num1)+'次')
7167
if req.get(r'https://graph.microsoft.com/v1.0/me/drive/root/children',headers=headers).status_code == 200:
@@ -80,9 +76,9 @@ def main():
8076
if req.get(r'https://graph.microsoft.com/v1.0/me/outlook/masterCategories',headers=headers).status_code == 200:
8177
num1+=1
8278
print('10调用成功'+str(num1)+'次')
83-
print('此次运行时间为 :', localtime)
79+
print('此次运行结束时间为 :', localtime)
8480
except:
8581
print("pass")
8682
pass
87-
for _ in range(random.randint(10,100)):
83+
for _ in range(5):
8884
main()

0 commit comments

Comments
 (0)