In [1]:
from memair import Memair
# Use Otto the sandbox user's access token or create your own at https://memair.com/temporary_access_token
access_token = '0000000000000000000000000000000000000000000000000000000000000000'

user = Memair(access_token)
In [2]:
query = '''
    {
      Locations(
        first: 10000
        within: "40.7587,-73.9787,8000"
        from_timestamp: "2018-05-01"
        order: random
      ) {
        lat
        lon
      }
    }

'''
response = user.query(query)

locations = response['data']['Locations']
f"{len(locations)} locations"
Out[2]:
'10000 locations'
In [3]:
import folium
from folium.plugins import HeatMap

data = [ [loc['lat'], loc['lon'], 1] for loc in locations ]
    
folium_heatmap = folium.Map(location   = [40.7587, -73.9787],
                            zoom_start = 12,
                            tiles      = "CartoDB positron")

HeatMap(data).add_to(folium_heatmap)
folium_heatmap
Out[3]:
In [ ]: