【问题标题】:Python Requests TypeError: not all arguments converted during string formatting [duplicate]Python请求TypeError:字符串格式化期间并非所有参数都转换[重复]
【发布时间】:2017-01-18 13:49:00
【问题描述】:

我正在使用 Python 请求模块,但遇到了麻烦。 我正在尝试做一个请求,这是代码:

params = {"user_id":"1234567890", "api":"API-KEY"}
method = 'getUserStatus'
requests.get("https://www.example.com/“ % method, params)

但我收到此错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: not all arguments converted during string formatting

感谢您的回复, 马可

【问题讨论】:

标签: python python-requests typeerror


【解决方案1】:

您需要使用正确的格式更新您的代码 - requests.post('https://api.iata.ovh/{0}.format(method), params)

【讨论】:

    猜你喜欢
    • 2021-08-09
    • 2015-10-28
    • 2013-10-21
    • 1970-01-01
    • 2022-07-24
    • 2017-08-13
    • 2020-11-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多