Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def add_product_detail(details):
new = db["products"]
ASIN = details["url"][len(details["url"])-10:len(details["url"])]
details["date"] = datetime.datetime.utcnow()
try:
new.update_one(
{
"asin":ASIN
},
{
"$set": {
"asin":ASIN
},
"$push":{
"details":details
}
},
upsert=True
)
return True
except Exception as identifier:
print(identifier)
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment