Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

634
Views
'property' object is not iterable trying to get response after calling the API being used

I have this error when I am trying to get response after the call of the API I want to use.

ValueError: [TypeError("'property' object is not iterable"), 
  TypeError('vars() argument must have __dict__ attribute')]

I am trying to use fastapi in order get from the client the latitudes and longitudes so i could show the public trasnportation of that area. I could do this with an API called GeoApify. However, I have a problem and I can not find my error.

I make a request by using a dictionary in order to put all the parameters for my filter and then I convert the response to JSON. But i have this error.

 from pickletools import string1
    from fastapi import FastAPI
    import requests
    from requests.structures import CaseInsensitiveDict
    
    app = FastAPI()
    
    
    @app.get("/thanos/{lon}/{lat}")
    async def read_item(lat : float,lon : float):
        url = "https://api.geoapify.com/v2/places"
        headers = CaseInsensitiveDict()
    
        dict = {
            "categories" :   'public_transport',
            "filter"     :   'circle:' + str(lon) + ',' + str(lat) + ",500",
            "limit"      :   '20',
            "apiKey"     :   '086a77f34e3a4ed583da9606318ca0ac'
         }
    
    
        params = dict
        headers = CaseInsensitiveDict(params)
            
        headers["Accept"] = "application/json"
    
        resp = requests.get(url, headers = headers)
    
        # resp = requests.get(url = url, params = params)
        data = resp.json
        return resp
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Use as below:

from fastapi import FastAPI
import requests
from requests.structures import CaseInsensitiveDict
import urllib

app = FastAPI()

url = "https://api.geoapify.com/v2/places"

@app.get("/{lon}/{lat}")
async def read_item(lat : float, lon : float):
    params = {
       "categories" :   'public_transport',
       "filter"     :   'circle:' + str(lon) + ',' + str(lat) + ",500",
       "limit"      :   '20',
       "apiKey"     :   '086a77f34e3a4ed583da9606318ca0ac'
    }

    headers = CaseInsensitiveDict()
    headers["Accept"] = "application/json"
    
    params = urllib.parse.urlencode(params)
    resp = requests.get(url=url, params=params, headers=headers)
    
    return resp.json()
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!