123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #!/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: 2019/4/2 15:17
- @Version: python3.6
- @MODIFY DECORD:ansjer dev
- @file: testttt.py
- @Contact: chanjunkai@163.com
- """
- # !/usr/bin/python3
- # !/usr/bin/python3
- #
- # import uuid
- #
- #
- #
- # udt = uuid.uuid1()
- # print(udt)
- # exit()
- import requests
- didir = 'D:/13.56.215.252/git/AnsjerFormal/templates/adf.jpg'
- url = 'http://apg.oss-cn-shenzhen.aliyuncs.com/TN7MPE3211UE76AP111A%2F9%2F1234561234.jpeg?OSSAccessKeyId=LTAIyMkGfEdogyL9&Expires=1554798738&Signature=YDt9q5IEjor7sSzyYleQe9fRye4%3D'
- r = requests.put(url,data=open(didir,'rb'))
- print(r.status_code)
- exit()
- import smtplib
- from email.mime.text import MIMEText
- from email.utils import formataddr
- # my_sender = '1758730877@qq.com' # 发件人邮箱账号
- # my_pass = 'jeridalqsufbdbdc' # 发件人邮箱密码
- my_sender = 'sara@zositech.com' # 发件人邮箱账号
- my_pass = 'FMEfRvfUDWNAj145' # 发件人邮箱密码
- my_user = '1758730877@qq.com' # 收件人邮箱账号,我这边发送给自己
- ret = True
- try:
- msg = MIMEText('填写邮件内容', 'plain', 'utf-8')
- msg['From'] = formataddr(["FromRunoob", my_sender]) # 括号里的对应发件人邮箱昵称、发件人邮箱账号
- msg['To'] = formataddr(["FK", my_user]) # 括号里的对应收件人邮箱昵称、收件人邮箱账号
- msg['Subject'] = "菜鸟教程发送邮件测试" # 邮件的主题,也可以说是标题
- server = smtplib.SMTP_SSL("hwsmtp.qiye.163.com", 994) # 发件人邮箱中的SMTP服务器,端口是25
- # server = smtplib.SMTP_SSL("smtp.qq.com", 465) # 发件人邮箱中的SMTP服务器,端口是25
- server.login(my_sender, my_pass) # 括号中对应的是发件人邮箱账号、邮箱密码
- server.sendmail(my_sender, [my_user, ], msg.as_string()) # 括号中对应的是发件人邮箱账号、收件人邮箱账号、发送邮件
- server.quit() # 关闭连接
- except Exception as e: # 如果 try 中的语句没有执行,则会执行下面的 ret=False
- print(repr(e))
- ret = False
- else:
- print('success')
- exit()
- import smtplib
- from email.mime.text import MIMEText
- from email.utils import formataddr
- my_sender = 'zositech@gmail.com' # 发件人邮箱账号
- my_pass = 'ZHzxb0805' # 发件人邮箱密码
- my_user = 'chanjunkai@163.com' # 收件人邮箱账号,我这边发送给自己
- ret = True
- try:
- msg = MIMEText('填写邮件内容', 'plain', 'utf-8')
- msg['From'] = formataddr(["FromRunoob", my_sender]) # 括号里的对应发件人邮箱昵称、发件人邮箱账号
- msg['To'] = formataddr(["FK", my_user]) # 括号里的对应收件人邮箱昵称、收件人邮箱账号
- msg['Subject'] = "菜鸟教程发送邮件测试" # 邮件的主题,也可以说是标题
- server = smtplib.SMTP_SSL("smtp.gmail.com", 465) # 发件人邮箱中的SMTP服务器,端口是25
- server.login(my_sender, my_pass) # 括号中对应的是发件人邮箱账号、邮箱密码
- server.sendmail(my_sender, [my_user, ], msg.as_string()) # 括号中对应的是发件人邮箱账号、收件人邮箱账号、发送邮件
- server.quit() # 关闭连接
- except Exception as e: # 如果 try 中的语句没有执行,则会执行下面的 ret=False
- print(repr(e))
- ret = False
- else:
- print('success')
- exit()
- # -*- coding: utf-8 -*-
- # import requests
- # url = requests.put('http://apg.oss-cn-shenzhen.aliyuncs.com/xaa?Signature=9nVkM5bE6%2B601E8kVPTlt%2B7zg%2FI%3D&OSSAccessKeyId=LTAIyMkGfEdogyL9&Expires=1554278510',data='asf')
- # print(url.status_code)
- # exit()
- import oss2
- # 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录 https://ram.console.aliyun.com 创建RAM账号。
- auth = oss2.Auth('LTAIyMkGfEdogyL9', '71uIjpsqVOmF7DAITRyRuc259jHOjO')
- # Endpoint以杭州为例,其它Region请按实际情况填写。
- bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'cnvod1')
- # 设置此签名URL在60秒内有效。
- # url = bucket.sign_url('PUT', 'wupengyangceshi.png', 60)
- url = bucket.sign_url('PUT', 'wupengyangceshi.png', 60)
- print(url)
- # import requests
- # r = requests.put(url,data='xadf')
- # print(r.content)
|