Exemple #1
0
		def Get_blog163(self, model, pushitem, **kwargs):
			try:
				form_fields = {
						"title": htmllib.encoding(stringQ2B(htmllib.encoding(model.title)), 'gb2312'),
						"content": htmllib.encoding(stringQ2B(htmllib.encoding(model.content)), 'gb2312'),
						"name": pushitem.username,
						"password":pushitem.password
						}
				form_data = urllib.urlencode(form_fields)
				result = urlfetch.fetch(url='http://blog.163.com/common/targetgo.s',
							payload=form_data,
							method=urlfetch.POST,
							headers={'Content-Type': 'application/x-www-form-urlencoded'})

				if result.status_code == 200:
						return self.Get_True(model, pushitem)


				elif result.status_code == 500:
						logging.error('Push %s returned with status code 500.' % pushitem.pushurl)
						return False
				elif result.status_code == 404:
						logging.error('Error 404: Nothing found at %s.' % pushitem.pushurl)
						return False


			except Exception, data:
				return self.Get_False(model, pushitem, data)
Exemple #2
0
		def Get_qzone(self, model, pushitem, **kwargs):
				try:
						message = mail.EmailMessage()
						message.sender = '*****@*****.**' % pushitem.username
						message.to = '*****@*****.**' % pushitem.username
						message.body = htmllib.encoding(stringQ2B(htmllib.encoding(model.content)), 'gb2312')
						message.subject = htmllib.encoding(stringQ2B(htmllib.encoding(model.title)), 'gb2312')
						message.send()
						return self.Get_True(model, pushitem)
				except Exception, data:
						return self.Get_False(model, pushitem, data)
Exemple #3
0
		def Get_qq_msgs(self, model, pushitem, **kwargs):
				"""
				this method is used to get login to website,and put the content to the micro blog
				"""
				try:


					content = '#%s# %s 详细内容请查看:%s' % (htmllib.encoding(stringQ2B(htmllib.encoding(model.title)), 'utf-8'),
								htmllib.encoding(stringQ2B(htmllib.encoding(htmllib.Filter_html(model.excerpt))), 'utf-8')[:100],
								str(model.fullurl))
					result = self.send_sina_msgs(pushitem.username, pushitem.password, content)
					if result:
						return self.Get_True(model, pushitem)
					else:
						return self.Get_False(model, pushitem)
				except Exception, data:
						return self.Get_False(model, pushitem, data)