Last active
May 21, 2017 09:03
-
-
Save OriHoch/978c7a62323ba380b9d06df56721cabe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from pymongo import MongoClient | |
import os | |
import requests | |
client = MongoClient(os.environ.get("MONGO_HOST", "localhost"), int(os.environ.get("MONGO_PORT", "27017"))) | |
db = client[os.environ["MONGO_DB"]] | |
photoUnits = db['photoUnits'] | |
data = requests.get("https://raw.githubusercontent.com/Beit-Hatfutsot/dbs-bagnowka-scrape/master/bagnowka_all.json").json() | |
count = 0 | |
for slug in data: | |
data[slug]["Header"]["He"] = "null" | |
photoUnits.insert_one(data[slug]) | |
count += 1 | |
print("1 item was added to photoUnits") | |
print("{} items were inserted to photoUnits.".format(count)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Latest version on server here