import requests
cord = "rajapur" + ".json"
type = "place,address,postcode"
payload = {
"country": "in",
"limit": "1",
"proximity": "ip",
"types": type,
"language": "en",
"access_token": "pk.eyJ1IjoicmFoaWxrYXppIiwiYSI6ImNreTZ3aGJuejB6eHIyd3FucWZ1NjJ6aGYifQ.MCL1g4wmi0BPlOMyNl-ZTg",
}
r = requests.get(
"https://api.mapbox.com/geocoding/v5/mapbox.places/" + cord, params=payload)
print(r.text)
print(r.url)
OUTPUT
{"type":"FeatureCollection","query":["rajapur"],"features":[{"id":"place.6954790964659160","type":"Feature","place_type":["place"],"relevance":1,"properties":{"wikidata":"Q963674"},"text_en":"Rajapur","language_en":"en","place_name_en":"Rajapur, Maharashtra, India","text":"Rajapur","language":"en","place_name":"Rajapur, Maharashtra, India","bbox":[73.304882,16.500805,73.864665,16.790159],"center":[73.522296,16.654461],"geometry":{"type":"Point","coordinates":[73.522296,16.654461]},"context":[{"id":"district.9267072385734640","wikidata":"Q1771768","text_en":"Ratnagiri","language_en":"en","text":"Ratnagiri","language":"en"},{"id":"region.11712446254386080","short_code":"IN-MH","wikidata":"Q1191","text_en":"Maharashtra","language_en":"en","text":"Maharashtra","language":"en"},{"id":"country.14770391688208260","wikidata":"Q668","short_code":"in","text_en":"India","language_en":"en","text":"India","language":"en"}]}],"attribution":"NOTICE: © 2022 Mapbox and its suppliers. All rights reserved. Use of this data is subject to the Mapbox Terms of Service (https://www.mapbox.com/about/maps/). This response and the information it contains may not be retained. POI(s) provided by Foursquare."}
please append these code below to your code
res = r.json()
print(res['features'][0]['geometry']['coordinates'])
you can learn more about json.