The basic approach is here that you have a URL (Web address) that points to the location of some geospatial data file. Always be careful when opening data from the internet, although I have not yet heard about any weaknesses in Python being exploited. The most common files that can be opened directly from a web store are GeoJSON and KML for vector data and TIFF files for raster data. For an overview of geospatial file types, see the Table of common geospatial data formats.
In this example, I will use the library requests to handed the data loading and the mapping library Folium
You can access the notebook on GitHub here https://github.com/geoinformatics-online/notebooks/blob/main/load_geojson_from_a_web_adress.ipynb and from there run it in Colab
import folium import requests
# URL for USGS earthquake data in GeoJSON format url = 'https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_month.geojson' # Retrieve the data from the URL response = requests.get(url) data = response.json() # Create a map object centered on the United States m = folium.Map(location=[0, 0], zoom_start=3) # Iterate through the features in the data for feature in data['features']: # Extract the coordinates and magnitude of the earthquake coords = feature['geometry']['coordinates'] mag = feature['properties']['mag'] # Create a circle marker on the map for the earthquake folium.CircleMarker(location=[coords, coords], radius=mag*3, color='red', fill=True).add_to(m) # Display the map m