两掺豆腐脑丶
提出一个问题,往往比解决一个问题更重要。
只有虚心好学,才能不断提高。
展开
-
requrests.Session
cms_tk.py# -*- coding: utf-8 -*-"""@Time : 2021/12/17 15:06@Author : 阿涛@"""# 封装类,高频使用,根据requrest模拟import requests# 参考requests.postrequests.getrequests.sessionrequests.Sessionclass TK_CMSApi(object): # 双下方法 def __init__(self, h原创 2022-01-19 23:00:58 · 135 阅读 · 0 评论 -
test_cms
# -*- coding: utf-8 -*-"""@Time : 2021/12/16 14:18@Author : 阿涛@"""import hashlibimport unittestfrom random import randomfrom api.cms_teacher import CMSApiimport requestsimport my_randclass TestCMS(unittest.TestCase): session = request原创 2022-01-19 23:02:44 · 120 阅读 · 0 评论 -
test_location_cms
# -*- coding: utf-8 -*-"""@Time : 2021/12/21 9:44@Author : 阿涛@"""import unittestimport requestsclass TestlocationCMS(unittest.TestCase): def Headers_(self): # 公有方法 请求头类型 # self.session headers = { "User-Agent原创 2022-01-19 23:04:15 · 115 阅读 · 0 评论 -
html_test_runner
"""A TestRunner for use with the Python unit testing framework. Itgenerates a HTML report to show the result at a glance.The simplest way to use this is to invoke its main method. E.g. import unittest import HTMLTestRunner ... define your te原创 2022-01-19 23:11:36 · 193 阅读 · 1 评论 -
pymysql封装
# -*- coding: utf-8 -*-"""@Time : 2021/12/14 17:20@Author : 阿涛@"""import pymysqlclass MysqlUtil(object): conn = pymysql.Connect( user="root", password="123456", host="192.168.31.72", port=3306, datab原创 2022-01-19 23:12:04 · 175 阅读 · 0 评论 -
email
# -*- coding: utf-8 -*-"""@Time : 2021/12/11 15:54@Author : zero"""import osfrom smtplib import SMTP_SSLfrom email import encodersfrom email.mime.base import MIMEBasefrom email.mime.multipart import MIMEMultipartfrom email.mime.text import原创 2022-01-19 23:10:48 · 170 阅读 · 0 评论 -
main_
# -*- coding: utf-8 -*-"""@Time : 2021/12/11 17:06@Author : zero"""import unittestfrom time import strftimefrom utils.html_test_runner import HTMLTestRunnerfrom utils.email_ import EmailUtilsuite = unittest.defaultTestLoader.discover( s原创 2022-01-19 23:10:10 · 78 阅读 · 0 评论 -
test_tk
# -*- coding: utf-8 -*-"""@Time : 2021/12/17 14:25@Author : 阿涛@"""import hashlibimport jsonimport reimport unittestfrom api.cms_tk import TK_CMSApiimport requestsdef get_sig(data_dict) -> str: params_str = "".join(sorted([f"{k}={v}原创 2022-01-19 23:07:13 · 118 阅读 · 0 评论 -
test_tea_TestCMS
# -*- coding: utf-8 -*-"""@Time : 2021/12/16 17:42@Author : 阿涛@"""# -*- coding: utf-8 -*-"""@Time : 2021/12/16 14:11@Author : zero"""import unittestimport requestsimport my_randimport random# from api.cms import CMSApifrom api.cms原创 2022-01-19 23:06:20 · 82 阅读 · 0 评论 -
sig_request
cms_teacher.py# -*- coding: utf-8 -*-"""@Time : 2021/12/16 17:21@Author : zero"""import requestsimport timeimport hashliba: 666b: 777class CMSApi(object): def __init__(self, host, public_body=None): # host = "http://192.168原创 2022-01-19 22:56:47 · 74 阅读 · 0 评论 -
request二次封装
cms.py# -*- coding: utf-8 -*-"""@Time : 2021/12/16 17:21@Author : zero"""import requests# requests.postclass CMSApi(object): # 初始化函数 用于初始化变量 def __init__(self, host, public_body): # public_body 公共体参数 # host = "http://192.原创 2022-01-19 22:54:07 · 477 阅读 · 0 评论