【问题标题】:How do we pass dynamic values in the url ? (python)我们如何在 url 中传递动态值? (Python)
【发布时间】:2023-01-12 11:47:30
【问题描述】:

例如:我正在从响应主体捕获 key=value 对,并希望在获取端点 url 中发送相同的值,如下所示,但它不起作用。你能就此提出建议吗?

我试过这个,它不起作用! 和


self.client.get("auth/logout?type=user&refresh_token=" + str(self.refresh_token),
                     headers={"access_token": str(self.access_token)},
                     catch_response=True) ```

【问题讨论】:

    标签: python api testing locust


    【解决方案1】:

    使用 Python 的 f-string 怎么样?

    self.client.get(f"auth/logout?type=user&refresh_token={self.refresh_token}",
                    headers={"access_token": f"{self.access_token}"},
                    catch_response=True) `
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-02
      • 1970-01-01
      • 2013-04-09
      • 1970-01-01
      • 1970-01-01
      • 2013-11-09
      • 1970-01-01
      相关资源
      最近更新 更多