代码拉取完成,页面将自动刷新
import os, tempfile, time
from os import getenv as _
from utils import uploader
from dotenv import load_dotenv
load_dotenv()
os.environ['UPLOAD_DRIVE'] = os.sys.argv[1]
handle, params = uploader().handle, uploader().params()
def upload(size):
fd, path = tempfile.mkstemp()
with open(path, 'wb') as f:
f.write(os.urandom(size * 1048576 - params['padding']))
r = handle(path)
os.close(fd)
os.unlink(path)
return r
def test(curr, step):
maps = {}
reve = False
reve_inc = None
print(f'Starting test {_("UPLOAD_DRIVE")}:')
while True:
if curr in maps:
result = maps[curr]
else:
result = maps[curr] = upload(curr)
print('%dM\t%s\t%s' % (curr, 'OK' if result else 'FAIL', result))
if not result:
reve = True
if not reve and curr > 20:
step = 20
if not reve and curr > 50:
step = 30
if not result and not reve_inc == None:
print(f'\n---\nFinally ... {reve_inc}M')
exit(0)
if reve and result:
reve_inc = curr
curr += 1
elif reve and not result:
if (curr - 1) % 5 == 0:
curr -= 1
else:
step //= 2
curr -= max(1, step)
if curr < 1:
curr = 1
reve_inc = 0
elif not reve:
curr += step
if __name__ == '__main__':
# print(handle('/Users/ika/Desktop/test/9913509E9DE4492E0E903B4C2C66E98D.gif'))
# print(handle('/Users/ika/Desktop/test/ACFC928140EE4FA072F4D6EB7CB35245.jpg'))
# print(handle('/Users/ika/Desktop/test/out00006.ts'))
test(1, 10)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。