原创文|Space9
需求描述
城通网盘免费用户保存的文件有时会因为过期被删除,通过以下的代码可以实现文件过期前的提醒。
代码实现
需要配置的参数可在城通网盘设置界面进行创建和获取。
# -*- coding:utf-8 -*-
import json
import time
import requests
def get_folder_list(folder_id, session):
"""https://openapi.ctfile.com/docs/ctfile-open-api/ctfile-open-api-1c9m8uh3njlcv"""
url = "https://rest.ctfile.com/v1/public/folder/list"
payload = {
"folder_id": folder_id,
"session": session
}
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=json.dumps(payload))
return json.loads(response.text)
def get_file_list(folder_id, session):
"""https://openapi.ctfile.com/docs/ctfile-open-api/ctfile-open-api-1c9kitkmo2gm8"""
url = "https://rest.ctfile.com/v1/public/file/list"
payload = {
"filter": "null",