testttt.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. @Copyright (C) ansjer cop Video Technology Co.,Ltd.All rights reserved.
  5. @AUTHOR: ASJRD018
  6. @NAME: AnsjerFormal
  7. @software: PyCharm
  8. @DATE: 2019/4/2 15:17
  9. @Version: python3.6
  10. @MODIFY DECORD:ansjer dev
  11. @file: testttt.py
  12. @Contact: chanjunkai@163.com
  13. """
  14. # -*- coding: utf-8 -*-
  15. import requests
  16. url = requests.put('http://cnvod1.oss-cn-shenzhen.aliyuncs.com/wupengyangceshi.png?OSSAccessKeyId=LTAIyMkGfEdogyL9&Expires=1554277819&Signature=4Pum%2Bpl8h4yO4ZcAgCURQJ7FTfQ%3D',data='jla;dksfjlk;asdjfklasdjlkfjdsa;lkfjlka;sdf;lkdsaj')
  17. print(url.status_code)
  18. exit()
  19. import oss2
  20. # 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录 https://ram.console.aliyun.com 创建RAM账号。
  21. auth = oss2.Auth('LTAIyMkGfEdogyL9', '71uIjpsqVOmF7DAITRyRuc259jHOjO')
  22. # Endpoint以杭州为例,其它Region请按实际情况填写。
  23. bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'cnvod1')
  24. # 设置此签名URL在60秒内有效。
  25. url = bucket.sign_url('PUT', 'wupengyangceshi.png', 60)
  26. print(url)
  27. # import requests
  28. # r = requests.put(url,data='xadf')
  29. # print(r.content)