0

I have an excel that has 'ID' key and API call URL

the Excel looks like this:

enter image description here

And the URL is this:

http://api.*******.com/2.0/location/{property_id}?key=123456ASDFG

The result of the API call is in JSON format

I would like to iterate the excel's property_id in the URL and save the result to csv in each row.

what I did so far is

import requests

import json

url = "http://api.*******.com/2.0/location/{property_id}?key=123456ASDFG"

response = requests.get(url)

data = response.test

print data

the result is basically same as what I just put the url in Chrome browser

I somehow have to read each row in the excel column A and switch the value and insert into {property_id} in the url then, append the result to csv as row number increases..

I'm very new to API and I have no idea where to start. I was trying to find similar questions on Stack-overflow and could not find any. (maybe wrong keywords?)

Any help is very helpful. Thanks

Pil Kwon
  • 153
  • 1
  • 9
  • https://python.gotrained.com/python-json-api-tutorial/ .. I think I can start from here. the thing is i do not know how to iterate the url in the excel's property_id column. – Pil Kwon Mar 28 '18 at 10:01
  • I search for `python read excel` and found some questions that are useful to start working with Excel file, like [Read Excel File in Python](https://stackoverflow.com/questions/22169325/read-excel-file-in-python) or [Reading/parsing Excel xls files with Python](https://stackoverflow.com/questions/2942889/reading-parsing-excel-xls-files-with-python). Hope it can help. – Hai Lang Mar 28 '18 at 12:06

0 Answers0