【发布时间】:2023-02-08 23:04:27
【问题描述】:
为了创建获取请求,我创建了一个 Python 脚本。为了为此请求创建 URL,我编写了以下代码:
today = str(datetime.date.today())
start = str(datetime.date.today()- datetime.timedelta (days=30))
report = ["Shifts",
"ShiftStops",
"ShiftStopDetailsByProcessDate",
"TimeRegistrations",
"ShiftsByProcessDate",
"ShiftStopsByProcessDate",
]
for x in report:
url_data = "https://URL"+ report + "?from=" + start + "&until=" + today
data = requests.get(url_data, headers = {'Host': 'services.URL.com', 'Authorization': 'Bearer ' + acces_token})```
But the error I get is: TypeError: can only concatenate str (not "list") to str
What can I do to solve this and create 6 unique url's?
p.s. I have added the word URL to the URL's in order to anonymize my post.
【问题讨论】:
-
"https://URL"+ report应该是"https://URL"+ x并修复缩进
标签: python python-3.x visual-studio-code