Riak & Timestamps (Python)

Mike Stoddart stodge at gmail.com
Sat Apr 2 21:13:29 EDT 2011

Just want to quickly clarify how to store timestamps in Riak Search
using Python. My code:

		dt = datetime.datetime.strptime(data['Time(PDT)'], "%b %d, %Y %H:%M:%S")
		ut = time.mktime(dt.timetuple())
		data['Time(PDT)'] = int(ut)
		# Save the object to Riak.
		json = simplejson.dumps(data)
		obj = bucket.new(data['Time(PDT)'], data=json)

This is giving me:

TypeError: 1275598830 has type <type 'int'>, but expected one of:
(<type 'str'>,)

Am I misunderstanding something fundamental here?


More information about the riak-users mailing list