【作业】完成交易市场查询用例,从发布商品到交易市场查询
811
等27人参与

7.9 【作业】完成交易市场查询用例,从发布商品到交易市场查询

【作业】我们在7.7中提过,平时的工作中,用例最好减少互相的依赖。大家来完成一下7.7中所说的交易市场查询用例,需要先发布商品,再去交易市场中查询到对应的商品,并做断言。

我的作业
去发布

登录后即可发布作业,立即

全部作业
import requests
from requests.adapters import HTTPAdapter
from common.yaml_config import GetConf
class Requests:
    def __init__(self,headers=None,timeout=10):
        self.s = requests.Session()
        self.s.mount("http://",HTTPAdapter(max_retries=3))
        self.s.mount("https://",HTTPAdapter(max_retries=3))
        self.s.headers = headers
        self.url = GetConf().get_url()
        self.timeout = timeout
    def get(self,url,params):
        res = self.s.get(self.url+url,params=params,timeout=self.timeout)
        return res
    def post(self,url,data=None,json=None):
        if data:
            res = self.s.post(self.url+url,data=data,timeout=self.timeout)
            return res
        if json:
            res = self.s.post(self.url+url,json=json,timeout=self.timeout)
            return res
        return self.s.post(self.url+url,timeout=self.timeout)
    def put(self,url,data=None,json=None):
        if data:
            res = self.s.put(self.url+url,data=data,timeout=self.timeout)
            return res
        if json:
            res = self.s.put(self.url+url,json=json,timeout=self.timeout)
            return res
        return self.s.put(self.url+url,timeout=self.timeout)
    def del1(self,url,params=None):
        res = self.s.delete(self.url+url,params=params,timeout=self.timeout)
        return res
    def __del__(self):
        if self.s:
            self.s.close()
  • 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
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 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
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
代码块
复制 预览
复制成功!
代码块
复制 预览
复制成功!
0
评论
提交于  2025-01-11 10:15:46

登录后即可查看更多作业,立即

微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号