예제 #1
0
	def test_indivudal_parser(self):
		expectedResults={
		'author': 'a guest',
		'date': 'Oct 31st, 2012',
		'title': 'CXF XML'
		}
		text=file(PASTEBIN_INDIVIDUAL_FILE_PATH,'rb').read()
		self.assertEquals(parsePastebinIndividualPaste(text),expectedResults)
예제 #2
0
def handleIndividualPaste(dd,pasteID):
	(fullPageResponse,rawPageResponse)=dd
	if fullPageResponse[0] and rawPageResponse[0]:
		pageDetails=parsePastebinIndividualPaste(fullPageResponse[1])
		try:
			rawPaste=rawPageResponse[1].decode('utf8','ignore')
		except (UnicodeDecodeError,UnicodeEncodeError), e:
			log.msg("The type of rawPageResponse[1] is %s" % str(type(rawPageResponse[1])))
			log.msg(str(e))
			raise e
		try:
			pageDetails['snippet']=rawPaste.split("\n")[0]
			fixedPasteDetails={}
			for (k,v) in pageDetails.items():
				fixedPasteDetails[k]=v.encode('utf8','ignore')
		except (UnicodeDecodeError,UnicodeEncodeError), e:
			log.msg("The type of v for key %s  is %s" % (k,str(type(v))))
			log.msg(str(e))
			raise e