Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import json
- from pymongo import MongoClient
- url = "[YOUR_RAKAM_API]/event/collect"
- client = MongoClient()
- client = MongoClient('localhost', 27017)
- db = client.test_database
- posts = db.posts
- for post in posts.find():
- response = requests.post(url, data=json.dumps({"api":{"api_key":"YOUR_WRITE_KEY"},
- "collection": "collection_name","properties":{ "_time": "2017-01-01T00:00:01", "_user": "userid", "an_attribute": post.get('an_attribute')}}))
Add Comment
Please, Sign In to add comment