Example #1
0
def embed_data(param):
	x = Videos()
	
	hash = param['hash']
	publc = str(param['publc'])

	# create a hash
	m = md5.new(publc + _private_key())

	# check if this hash is equal to the one transmitted
	if m.hexdigest() == hash:
		#param arrived 'encodeURIComponent' from the front end so use urllib.unquote_plus to decode
		data = {
			'data': urllib.unquote_plus(param['data']),
			'username' : param['username'],
			'is_public' : param['is_public'],
			'category' : param['category'],
			'tags' : param['tags'],
			'is_approved' : 0
		}

		return x.embed(data)
	else:
		return 'failed'