'Turning IP address into coordinates?

I'm right now working on a project which is a map, using folium. Until I realized, that I needed to get longitude and latitude. I tried using ipconfig and opencagedata but the output was my routers IPv4 Address. Therefore, I switched to socket, and it gave me a result. But now, I can't find a way to convert that specific string into coordinates.

Here is a simplified preview of it:

import folium;
Map = folium.Map(location=[latitude, longitude], zoom_start=10)
folium.Marker([latitude, longitude], popup=location).add_to(Map)
Map.save("C:\\Users\\%USERNAME%\\Desktop\\location.html")


Solution 1:[1]

You can use the freegeoapi API: https://freegeoip.app/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kovy Jacob