def push_db(self, title, url): global TABLE if 'mp.weixin.qq.com' not in url: print "not mp url" return url_hash = fnvhash.fnv_32a_str(url) d = {'title': title, 'p_url': url, 'url_hash': url_hash, } try: db.item_to_table(TABLE, d) except Exception, e: print Exception, e
def get_32_hash(input_data): if isinstance(input_data, unicode): input_data = input_data.encode('utf-8') output = fnvhash.fnv_32a_str(input_data) return output