Exemple #1
0
	def get(self,url,**kwargs):
		kwargs = apply_vars(kwargs, self.get_args)
		exec('pass') # apply locals. Copy+paste magic...
		data = kwargs['data'] # doesn't seem to work via other mechanism for some bizarre reason

		if proxy!=None:
			raise Exception, "URLTimeoutAppEngine can't handle proxies right now!"

		if data!=None:
			data = urlencode(data)
		if ref!=None:
			headers["Referer"] = ref
		try:
			grab = fetch(url,payload=data,headers=headers,deadline=self.getTimeout())
		except DownloadError,e:
			raise URLTimeoutError,(e.message,url)
Exemple #2
0
	def get(self,url,**kwargs):
		kwargs = apply_vars(kwargs, self.get_args)
		exec('pass') # apply locals. Copy+paste magic...
		data = kwargs['data'] # doesn't seem to work via other mechanism for some bizarre reason

		if proxy!=None:
			raise Exception, "URLTimeoutAsync can't handle proxies right now!"

		if data!=None:
			encode_data = urlencode(data)
		else:
			encode_data = None
		grab = asyncgrab(self,url,ref,headers,data=encode_data,debug=self.debug)
		if self.debug:
			grab.set_debuglevel(1)
		try:
			grab.connect()
		except socket.error,err:
			raise URLTimeoutError,(err[1],url)