Parsing and storing date into Mongodb

Mongodb’s representation of datetime is – number-of-milliseconds-since-epoch. To parse a date string entered in a form

from datetime import datetime, time
# getting date from form
dt = datetime.strptime(request.form['date'], '%Y-%m-%d')
# adding date for a record
record = {}
# need to add time (0,0)
record['date'] = datetime.combine(dt, time())
view raw date_py_mongo hosted with ❤ by GitHub

Stumbled On Python Libraries

I am making a list of libraries which I discover while reading blogs, mailing lists, etc. and feel can be useful.

1. Requests An inspiring library, already used in many small python scripts.

2. django-mediagenerator asset manager. Better are django-compressor and django-pipeline

3. Wappalyzer The blurb says “Wappalyzer is a browser extension that uncovers the technologies used on websites. It detects content management systems, web shops, web servers, JavaScript frameworks, analytics tools and many more.”