# -*- coding: utf-8 -*-

import os
from ucloud.ufile import getufilelist
from ucloud.compact import b
from ucloud.logger import logger, set_log_file
import ucloud.ufile.config as config
from ucloud.compact import BytesIO
import requests

from sdk.config_prod import *

set_log_file()
public_key = PUBLIC_KEY  #添加自己的账户公钥
private_key = PRIVATE_KEY  #添加自己的账户私钥

if __name__ == '__main__':

    # 构造对象,并设置公私钥
    handler = getufilelist.GetFileList(public_key, private_key)

    # 目标空间
    bucket = "mf23"
    # 设置每页的数量
    mylimit = 20

    # 获取第一页
    ret, resp = handler.getfilelist(bucket, limit=mylimit)
    assert resp.status_code == 200
    print("count:%d" % len(ret['DataSet']))
    for item in ret['DataSet']:
Esempio n. 2
0
# -*- coding: utf-8 -*-

import unittest
import os
from ucloud.ufile import postufile
from ucloud.compact import b
from ucloud.logger import logger, set_log_file
from ucloud.ufile.config import BLOCKSIZE, get_default
from ucloud.compact import BytesIO

set_log_file()
public_key = '' #添加自己的账户公钥
private_key = '' #添加自己的账户私钥
public_bucket = '' #公共空间名称
private_bucket = '' #私有空间名称

wrong_public_key = 'dfajlkfladjfa'
wrong_private_key = 'fajdlfjkkkkkk'

small_local_file = './small.jpg'
post_small_key = 'post_small'

big_local_file = './Wildlife.wmv'
post_big_key = 'post_big'

bio = BytesIO(u'你好'.encode('utf-8'))
post_stream_key = 'post_stream'

wrong_bucket = 'david-wrong'
wrong_key = 'wrong'