Skip to content

Instantly share code, notes, and snippets.

@OriHoch
Last active May 21, 2017 09:03
Show Gist options
  • Save OriHoch/978c7a62323ba380b9d06df56721cabe to your computer and use it in GitHub Desktop.
Save OriHoch/978c7a62323ba380b9d06df56721cabe to your computer and use it in GitHub Desktop.
#!/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))
@Libisch
Copy link

Libisch commented May 21, 2017

Latest version on server here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment