# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
# Insert Multiple Data

# +
from pymongo import MongoClient


client = MongoClient(
    "mongodb.fastcamp.us",
)

# +
db = client["dobestan"]

collection = db["zigbang"]
collection.remove()
collection = db["zigbang"]
# -

assert collection.count() is 0

import requests
import json

response = requests.get("https://api.zigbang.com/v1/items?detail=true&item_ids=3377348&item_ids=3661969&item_ids=3540767&item_ids=3648625&item_ids=3592832&item_ids=3628879&item_ids=3561673&item_ids=3609638&item_ids=3673409&item_ids=3592285&item_ids=3604128&item_ids=3600327&item_ids=3673218&item_ids=3672485&item_ids=3470573&item_ids=3343690&item_ids=3307263&item_ids=3656804&item_ids=2898516&item_ids=3673576&item_ids=3551788&item_ids=3675742&item_ids=3430678&item_ids=3637311&item_ids=3341551&item_ids=3598153&item_ids=3372490&item_ids=3537735&item_ids=3528364&item_ids=3598268&item_ids=3485646&item_ids=3533615&item_ids=3552246&item_ids=3577436&item_ids=3636629&item_ids=3500969&item_ids=3521848&item_ids=3502500")

zigbang_dict = json.loads(response.text)

zigbang_dict['items']

collection.insert_many(zigbang_dict['items'])

collection.count()

collection.find_one()

StarcoderdataJupyterScriptsDedupFiltered