[英]How can I pass dynamic values in the URL?
I am capturing key=value
pairs from a response body and want to send the same value in the get end point URL as below.我正在从响应正文中捕获
key=value
对,并希望在获取端点 URL 中发送相同的值,如下所示。
I tried this, which does not work:我试过这个,它不起作用:
self.client.get("auth/logout?type=user&refresh_token=" + str(self.refresh_token),
headers={"access_token": str(self.access_token)},
catch_response=True)
How about using Python's f-string?使用 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) `
But that your code doesn't work has very likely to do with some logics of the get() method.但是您的代码不起作用很可能与 get() 方法的某些逻辑有关。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.