0
点赞
收藏
分享

微信扫一扫

pypostman

五殳师兄 2023-11-06 阅读 138

from pypostman.postman import Postman
from pypostman.modules.http import Request

postman = Postman()
collections_dir = "../collections"
collections = postman._get_collections(dir=collections_dir)
pokeapi_collection = postman._get_collection(name="PokeAPI", collections=collections)
pokeapi_requests = postman._get_requests(collection=pokeapi_collection)

def pokemon(self, **kwargs):
    name = "/pokemon"
    pokemon = postman._get_request(name=name, requests=pokeapi_requests)
    prepared_request: Request = Request(request=pokemon)
    prepared_request.set_path_vars(kwargs)
    prepared_request.set_params(kwargs)
    response = prepared_request.send
    return response

举报

相关推荐

pypostman 发送HTTP请求

0 条评论