#!/usr/bin/env python3  
# -*- coding: utf-8 -*-  
"""
@Copyright (C) ansjer cop Video Technology Co.,Ltd.All rights reserved.
@AUTHOR: ASJRD018
@NAME: AnsjerFormal
@software: PyCharm
@DATE: 2018/9/19 10:53
@Version: python3.6
@MODIFY DECORD:ansjer dev
@file: oss.py
@Contact: chanjunkai@163.com
"""
from oss2 import *
from oss2.models import *
import time
from var_dump import var_dump
import urllib

###########
host = "oss-cn-shenzhen.aliyuncs.com"  # just for example
# host = "hlsvoda.zositech.cn"  # just for example
# host = 'oss-eu-central-1.aliyuncs.com'

accessid = 'LTAIyMkGfEdogyL9'
accesskey = '71uIjpsqVOmF7DAITRyRuc259jHOjO'



import oss2

# 阿里云主账号AccessKey拥有所有API的访问权限，风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维，请登录 https://ram.console.aliyun.com 创建RAM账号。
auth = Auth(accessid, accesskey)

# Endpoint以杭州为例，其它Region请按实际情况填写。
service = oss2.Service(auth, host)


bucket_name = "cnvod1"
auth = Auth(accessid, accesskey)
bucket = Bucket(auth, host, bucket_name)
result = bucket.append_object('mio', 23, '我是追加的噢噢噢噢content of first append')
# 如果不是首次上传，可以通过bucket.head_object方法或上次追加返回值的next_position属性，得到追加位置。
# bucket.append_object('<yourObjectName>', result.next_position, 'content of second append')
print(result.next_position)