python code for getting data into mongodb