foursquare code error: TypeError: can only concatenate str (not "tuple") to str

foursquare code error: TypeError: can only concatenate str (not "tuple") to str

我有这个项目,我知道这个问题很愚蠢,但我真的无法解决它。 如果有人能帮助我,我真的很感激:)

import requests
import json

payload = {}
headers = {}
ll1 = 18.036442,42.492103
ll2 = 18.036808,42.117917
ll3 = 18.458814,42.485903
ll4 = 18.453989,42.115408


def make_request(payload, headers, ll1, ll2, ll3, ll4):

url = "https://api.foursquare.com/v2/venues/search?client_id=VFFCWVM5UPLGNOS3IAQHQB5LLZBIRYZTGUYW40JHKSEMM0BR" \
      "&client_secret=PCF41XEGDNVIZSZT5ULESYGZUTW02TVYKX5IOAEAAMF5GYP1&v=20210927&token" \
      "=AEOYTHHSPVCSNNBFRT0RCH55KVRXJ1EH2XDSXPIWEWJEMEPG&ll=" +ll1+ +ll2 +ll3 +ll4+ \
      "&intent=browse&radius=10000 "
response = requests.request("GET", url, headers=headers, data=payload)
return response.text


data = make_request(payload, headers, ll1, ll2, ll3, ll4)

print (data)

我得到的错误是:

Traceback (most recent call last):
  File "/Users/hessa/Desktop/main01.py", line 22, in <module>
    data = make_request(payload, headers, ll1, ll2, ll3, ll4)
  File "/Users/hessa/Desktop/main01.py", line 14, in make_request
    url = "https://api.foursquare.com/v2/venues/search?client_id=VFFCWVM5UPLGNOS3IAQHQB5LLZBIRYZTGUYW40JHKSEMM0BR" \
TypeError: can only concatenate str (not "tuple") to str

将变量作为字符串传递

ll1 = '18.036442,42.492103'
ll2 = '18.036808,42.117917'
ll3 = '18.458814,42.485903'
ll4 = '18.453989,42.115408'

这应该有效:

import requests
import json

payload = {}
headers = {}
ll1 = "18.036442,42.492103"
ll2 = "18.036808,42.117917"
ll3 = "18.458814,42.485903"
ll4 = "18.453989,42.115408"


def make_request(payload, headers, ll1):
    url = "https://api.foursquare.com/v2/venues/search?client_id=VFFCWVM5UPLGNOS3IAQHQB5LLZBIRYZTGUYW40JHKSEMM0BR" \
    "&client_secret=PCF41XEGDNVIZSZT5ULESYGZUTW02TVYKX5IOAEAAMF5GYP1&v=20210927&token" \
    "=AEOYTHHSPVCSNNBFRT0RCH55KVRXJ1EH2XDSXPIWEWJEMEPG&ll=" + ll1 + \
    "&intent=browse&radius=10000"
    response = requests.request("GET", url, headers=headers, data=payload)
    return response.text


data = make_request(payload, headers, ll1)
data = make_request(payload, headers, ll2)
data = make_request(payload, headers, ll3)
data = make_request(payload, headers, ll4)

print (data)