Instantly share code, notes, and snippets.

@d0n601 /
Last active Oct 27, 2017

What would you like to do? Scraper Proof of Concept
import json
import requests
#from pymongo import MongoClient
class LeaflyHarvest(object):
""" proof of concept data harvester.
def scrape_dispensaries(self):
Scrape all dispensaries from
:return: void
# API Endpoint to search for stuff on Leafly
url = ""
# Body of the request
data = {
"NorthwestLatitude": 57.70487627437739,
"NorthwestLongitude": -138.49595341516113,
"Page": 0,
"PremiumLocation": 84720,
"PremiumLocationType": "ZipCode",
"SoutheastLatitude": 12.898819268131966,
"SoutheastLongitude": -33.027203415161125,
"Take": 9000
data = json.dumps(data)
# Endpoint's response to you
response =, data=data, headers={"Content-Type": "application/json"}).json()
# Within this loop you could filter/store data...
for dispensary in response["Results"]:
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment