testttt.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. # !/usr/bin/python3
  15. # !/usr/bin/python3
  16. #
  17. # import uuid
  18. #
  19. #
  20. #
  21. # udt = uuid.uuid1()
  22. # print(udt)
  23. # exit()
  24. import requests
  25. didir = 'D:/13.56.215.252/git/AnsjerFormal/templates/adf.jpg'
  26. url = 'http://apg.oss-cn-shenzhen.aliyuncs.com/TN7MPE3211UE76AP111A%2F9%2F1234561234.jpeg?OSSAccessKeyId=LTAIyMkGfEdogyL9&Expires=1554798738&Signature=YDt9q5IEjor7sSzyYleQe9fRye4%3D'
  27. r = requests.put(url,data=open(didir,'rb'))
  28. print(r.status_code)
  29. exit()
  30. import smtplib
  31. from email.mime.text import MIMEText
  32. from email.utils import formataddr
  33. # my_sender = '1758730877@qq.com' # 发件人邮箱账号
  34. # my_pass = 'jeridalqsufbdbdc' # 发件人邮箱密码
  35. my_sender = 'sara@zositech.com' # 发件人邮箱账号
  36. my_pass = 'FMEfRvfUDWNAj145' # 发件人邮箱密码
  37. my_user = '1758730877@qq.com' # 收件人邮箱账号,我这边发送给自己
  38. ret = True
  39. try:
  40. msg = MIMEText('填写邮件内容', 'plain', 'utf-8')
  41. msg['From'] = formataddr(["FromRunoob", my_sender]) # 括号里的对应发件人邮箱昵称、发件人邮箱账号
  42. msg['To'] = formataddr(["FK", my_user]) # 括号里的对应收件人邮箱昵称、收件人邮箱账号
  43. msg['Subject'] = "菜鸟教程发送邮件测试" # 邮件的主题,也可以说是标题
  44. server = smtplib.SMTP_SSL("hwsmtp.qiye.163.com", 994) # 发件人邮箱中的SMTP服务器,端口是25
  45. # server = smtplib.SMTP_SSL("smtp.qq.com", 465) # 发件人邮箱中的SMTP服务器,端口是25
  46. server.login(my_sender, my_pass) # 括号中对应的是发件人邮箱账号、邮箱密码
  47. server.sendmail(my_sender, [my_user, ], msg.as_string()) # 括号中对应的是发件人邮箱账号、收件人邮箱账号、发送邮件
  48. server.quit() # 关闭连接
  49. except Exception as e: # 如果 try 中的语句没有执行,则会执行下面的 ret=False
  50. print(repr(e))
  51. ret = False
  52. else:
  53. print('success')
  54. exit()
  55. import smtplib
  56. from email.mime.text import MIMEText
  57. from email.utils import formataddr
  58. my_sender = 'zositech@gmail.com' # 发件人邮箱账号
  59. my_pass = 'ZHzxb0805' # 发件人邮箱密码
  60. my_user = 'chanjunkai@163.com' # 收件人邮箱账号,我这边发送给自己
  61. ret = True
  62. try:
  63. msg = MIMEText('填写邮件内容', 'plain', 'utf-8')
  64. msg['From'] = formataddr(["FromRunoob", my_sender]) # 括号里的对应发件人邮箱昵称、发件人邮箱账号
  65. msg['To'] = formataddr(["FK", my_user]) # 括号里的对应收件人邮箱昵称、收件人邮箱账号
  66. msg['Subject'] = "菜鸟教程发送邮件测试" # 邮件的主题,也可以说是标题
  67. server = smtplib.SMTP_SSL("smtp.gmail.com", 465) # 发件人邮箱中的SMTP服务器,端口是25
  68. server.login(my_sender, my_pass) # 括号中对应的是发件人邮箱账号、邮箱密码
  69. server.sendmail(my_sender, [my_user, ], msg.as_string()) # 括号中对应的是发件人邮箱账号、收件人邮箱账号、发送邮件
  70. server.quit() # 关闭连接
  71. except Exception as e: # 如果 try 中的语句没有执行,则会执行下面的 ret=False
  72. print(repr(e))
  73. ret = False
  74. else:
  75. print('success')
  76. exit()
  77. # -*- coding: utf-8 -*-
  78. # import requests
  79. # url = requests.put('http://apg.oss-cn-shenzhen.aliyuncs.com/xaa?Signature=9nVkM5bE6%2B601E8kVPTlt%2B7zg%2FI%3D&OSSAccessKeyId=LTAIyMkGfEdogyL9&Expires=1554278510',data='asf')
  80. # print(url.status_code)
  81. # exit()
  82. import oss2
  83. # 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录 https://ram.console.aliyun.com 创建RAM账号。
  84. auth = oss2.Auth('LTAIyMkGfEdogyL9', '71uIjpsqVOmF7DAITRyRuc259jHOjO')
  85. # Endpoint以杭州为例,其它Region请按实际情况填写。
  86. bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'cnvod1')
  87. # 设置此签名URL在60秒内有效。
  88. # url = bucket.sign_url('PUT', 'wupengyangceshi.png', 60)
  89. url = bucket.sign_url('PUT', 'wupengyangceshi.png', 60)
  90. print(url)
  91. # import requests
  92. # r = requests.put(url,data='xadf')
  93. # print(r.content)