-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend_request.py
More file actions
30 lines (25 loc) · 656 Bytes
/
send_request.py
File metadata and controls
30 lines (25 loc) · 656 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import logging
import allure
import requests
import pymysql
from config.config import *
@allure.step("2.发送 HTTP 请求")
def send_http_request(**request_data):
res = requests.request(**request_data)
logging.info(f"2.发送HTTP请求响应文本为: {res.text}")
return res
def send_jdbc_request(sql, index=0):
conn = pymysql.Connect(
host= DB_HOST,
port=DB_PORT,
database=DB_DATABASE,
user=DB_USER,
password=DB_PASSWORD,
charset=DB_CHARSET
)
cur = conn.cursor()
cur.execute(sql)
result = cur.fetchone()
cur.close()
conn.close()
return result[index]