Ejemplo n.º 1
0
	def post(self,fnr):
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
		except Exception as e:
			self.redirect("/")
			return
		if ( len(self.get_argument("topic",default=""))<1 ) or ( len(self.get_argument("desc",default=""))<1) or ( len(self.get_argument("pass",default=""))<1):
			self.render("strony/forumChangeData.html",title="no cos mojego z pythona",nick=self.current_user,oldtopic=self.get_argument("topic",default=""),olddescri=self.get_argument("desc",default=""))
			return
		post_data = { 'pass': str(self.get_argument("pass")) }
		body = urllib.parse.urlencode(post_data)
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/login/"+str(self.current_user.decode()),method='POST',body=body)
		except Exception as e:
			self.render("strony/forumChangeData.html",title="no cos mojego z pythona",nick=self.current_user,oldtopic=self.get_argument("topic",default=""),olddescri=self.get_argument("desc",default=""))
			return
		post_data_final = {'temat': str(self.get_argument("topic")),'descri': str(self.get_argument("desc"))}
		body_final = urllib.parse.urlencode(post_data_final)
		headerss = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			print("asd");
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr,method='PUT',headers=headerss,body=body_final)
		except Exception as e:
			raise e
			print("asdddddddddddddddddddd")
			self.render("strony/forumChangeData.html",title="no cos mojego z pythona",nick=self.current_user,oldtopic=self.get_argument("topic",default=""),olddescri=self.get_argument("desc",default=""))
			return
		self.redirect("/")
Ejemplo n.º 2
0
	def get(self,fnr,tnr,post):
		client = tornado.httpclient.AsyncHTTPClient()
		admin=0;
		topicname=""
		try:
			response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
			admin=1;
		except Exception as e:
			#self.redirect("/")
			pass

		if admin !=2:
			try:
				response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topic/"+tnr+"/post/"+post)
				lista = str(response.body)
				lista=lista.replace('<br>','')
				lista=lista.replace('\'','')
				lista=lista[1:]
				listaw = lista.split('\\t')
				#print(listaw[7])
				if listaw[5]==self.current_user.decode(): 
					admin=1;
			except Exception as e:
				pass
		if admin ==0:
			self.redirect("/")

			
		self.render("strony/deletePost.html",title="no cos mojego z pythona",nick=self.current_user)
Ejemplo n.º 3
0
	def get(self,fnr,tnr,pnr):
		client = tornado.httpclient.AsyncHTTPClient()
		admin=0;
		oldval=""
		try:
			response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
			admin=1;
		except Exception as e:
			#self.redirect("/")
			pass

		if admin !=2:
			try:
				response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topic/"+tnr+"/post/"+pnr)
				lista = str(response.body)
				lista=lista.replace('<br>','')
				lista=lista.replace('\'','')
				#lista=lista[1:]
				listaw = lista.split('\\t')
				oldval=listaw[3]
			
				#print(listaw[7])
				if listaw[5]==self.current_user.decode(): 
					admin=1;
			except Exception as e:
				raise e
				pass
		if admin ==0:
			self.redirect("/")
			return
		self.render("strony/postChangeData.html",title="no cos mojego z pythona",nick=self.current_user,fnr=fnr,tnr=tnr,pnr=pnr,oldval=oldval)
Ejemplo n.º 4
0
	def post(self,nick):
		if nick != self.current_user:
			client = tornado.httpclient.AsyncHTTPClient()
			try:
				response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
			except Exception as e:
				self.redirect("/")
				return
		if ( len(self.get_argument("nick"))<1 ) or ( len(self.get_argument("name"))<1) or ( len(self.get_argument("name2"))<1) or ( len(self.get_argument("mail"))<1) or ( len(self.get_argument("pass"))<1):
			self.render("strony/userChangeData.html",title="no cos mojego z pythona",nick=self.current_user,oldnick=self.get_argument("nick"),oldname=self.get_argument("name"),oldname2=self.get_argument("name2"),oldmail=self.get_argument("mail"))
			return
		post_data = { 'pass': str(self.get_argument("pass")) }
		body = urllib.parse.urlencode(post_data)
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/login/"+nick,method='POST',body=body)
		except Exception as e:
			self.render("strony/userChangeData.html",title="no cos mojego z pythona",nick=self.current_user,oldnick=self.get_argument("nick"),oldname=self.get_argument("name"),oldname2=self.get_argument("name2"),oldmail=self.get_argument("mail"))
		post_data_final = {'imie': str(self.get_argument("name")),'nazwisko': str(self.get_argument("name2")),'email': str(self.get_argument("mail")),'nick': str(self.get_argument("nick"))}
#		post_data_final = {'imie': "przykladowe imie"}
		body_final = urllib.parse.urlencode(post_data_final)
		headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
		client = tornado.httpclient.AsyncHTTPClient()
		try:
		        response = yield client.fetch("http://192.168.1.21:8888/user/"+nick,method='PUT',headers=headers,body=body_final)
	        	self.redirect("/user/"+self.get_argument("nick"))
		except Exception as e:
			raise e
			print("asdddddddddddddddddddd")
			self.render("strony/userChangeData.html",title="no cos mojego z pythona",nick=self.current_user,oldnick=self.get_argument("nick"),oldname=self.get_argument("name"),oldname2=self.get_argument("name2"),oldmail=self.get_argument("mail"))
Ejemplo n.º 5
0
	def post(self,fnr,tnr,post):
		if self.get_argument("option")!="yes":
                                self.redirect("/")
		client = tornado.httpclient.AsyncHTTPClient()
		admin=0;
		topicname=""
		try:
			response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
			admin=1;
		except Exception as e:
			#self.redirect("/")
			pass

		if admin !=2:
			try:
				response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topic/"+tnr+"/post/"+post)
				lista = str(response.body)
				lista=lista.replace('<br>','')
				lista=lista.replace('\'','')
				lista=lista[1:]
				listaw = lista.split('\\t')
				#print(listaw[7])
				if listaw[5]==self.current_user.decode(): 
					admin=1;
			except Exception as e:
				pass
		if admin ==0:
			self.redirect("/")
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topic/"+tnr+"/post/"+post,method='DELETE')	
			self.redirect("/")
		except Exception as e:
			self.redirect("/")
Ejemplo n.º 6
0
 def send_request(self, signed_path, data_string, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
     timeout = None if timeout == socket._GLOBAL_DEFAULT_TIMEOUT else timeout
     import tornado.httpclient
     absolute_url = self.get_absolute_path(signed_path)
     request = tornado.httpclient.HTTPRequest(absolute_url, method='POST', body=data_string, request_timeout=timeout)
     client = tornado.httpclient.AsyncHTTPClient()
     client.fetch(request, callback=self.callback)
     # Returning 202 to avoid Channel errors. Actual error handling takes place in callback.
     return 202, ""
Ejemplo n.º 7
0
	def post(self,fnr):
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/user/"+str(self.current_user.decode()))
		except Exception as e:
			self.redirect("/")
			return
		lista = str(response.body)
		lista=lista.replace('\'','')
		lista=lista[1:]
		listaw = lista.split('\\t')
		unr=listaw[4]
		if ( len(self.get_argument("topic",default=""))<1 ) or ( len(self.get_argument("value",default=""))<1):
			client = tornado.httpclient.AsyncHTTPClient()
			try:
				response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr)	
			except Exception as e:
	        		self.redirect("/")
#			return
			lista = str(response.body)
			lista=lista.replace('<br>','')
			lista=lista.replace('\'','')
			lista=lista[1:]
			listaw = lista.split('\\t')
			topic = listaw[2]
			self.render("strony/topicAdd.html",title="no cos mojego z pythona",nick=self.current_user,oldtopic=self.get_argument("topic",default=""),olddescri=self.get_argument("desc",default=""),oldvalue=self.get_argument("value",default=""),topic=topic,fnr=fnr)
			return
		
		post_data_u = { 'uid': unr }
		body_u = urllib.parse.urlencode(post_data_u)
		try:
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topics",method='POST',body=body_u)
		except Exception as e:
			raise e
			print("asd");
			self.redirect("/")
			return
		print(response.body.decode())
#		return

		post_data_final = {'temat': str(self.get_argument("topic")),'value': str(self.get_argument("value")),'description': str(self.get_argument("desc"))}
		body_final = urllib.parse.urlencode(post_data_final)
		headerss = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			print("asdd");
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topic/"+response.body.decode(),method='PUT',headers=headerss,body=body_final)
		except Exception as e:
			raise e
			print("asdddddddddddddddddddd")
			self.render("strony/topicAdd.html",title="no cos mojego z pythona",nick=self.current_user,oldtopic=self.get_argument("topic",default=""),olddescri=self.get_argument("desc",default=""),oldvalue=self.get_argument("value",default=""),topic=topic,fnr=fnr)
			return
		self.redirect("/forum/"+fnr)
Ejemplo n.º 8
0
	def post(self,fnr):
		if self.get_argument("option")!="yes":
                                self.redirect("/")
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
		except Exception as e:
			self.redirect("/")
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr,method='DELETE')	
			self.redirect("/")
		except Exception as e:
			self.redirect("/")
Ejemplo n.º 9
0
	def get(self,fnr,page):
		#if nick != self.current_user:
		#	serf.redirect('/')
		admin=0
		topic=""
		unr=-1
		if self.current_user!=None and self.current_user!="":
			client = tornado.httpclient.AsyncHTTPClient()
			try:
				response = yield client.fetch("http://192.168.1.21:8888/user/"+str(self.current_user.decode()))
			except Exception as e:
				self.redirect("/")
				return
			lista = str(response.body)
			lista=lista.replace('\'','')
			lista=lista[1:]
			listaw = lista.split('\\t')
			unr=listaw[4]
		client = tornado.httpclient.AsyncHTTPClient()
		response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topics/"+page)	
		lista = str(response.body)
		print(lista)
		lista=lista.replace('<br>','')
		lista=lista.replace('\'','')
		lista=lista[1:]
		listaw = lista.split('\\n')
		listawyn = []
		for a in listaw:
			listawyn.append(a.split('\\t'))
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr)	
			lista = str(response.body)
			lista=lista.replace('<br>','')
			lista=lista.replace('\'','')
			lista=lista[1:]
			listaw = lista.split('\\t')
			topic = listaw[2]
		except Exception as e:
	        	self.redirect("/")
#			return
		admin=0
		try:
			client = tornado.httpclient.AsyncHTTPClient()
			response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
			admin=1
		except Exception as e:
			admin=0
#				self.write(e)o	
		self.render("strony/topicsList.html",title="no cos mojego z pythona",nick=self.current_user,topic=topic,fnr=fnr,danen=listawyn,unr=unr,admin=admin)
Ejemplo n.º 10
0
	def get(self,fnr):
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
		except Exception as e:
			self.redirect("/")
		self.render("strony/deleteForum.html",title="no cos mojego z pythona",nick=self.current_user)
Ejemplo n.º 11
0
    async def get(self) -> None:
        if not self._manifest:
            shell = [
                'index.html',
                *self._server.client_config['shell'],
                f"!{self._server.client_config['service_path']}",
                *(pattern.format(self._server.client_config['modules_path'])
                  for pattern in self._MICRO_CLIENT_SHELL)
            ]
            shell = [path.relative_to(self._server.client_config['path'])
                     for path in look_up_files(shell, top=self._server.client_config['path'])]
            shell = [path if path == Path('index.html') else Path('static') / path
                     for path in shell]
            # Instead of reading files directly, go through server to handle dynamic content (e.g.
            # rendered templates). Tornado does not provide an API to request a response, so fall
            # back to HTTP.
            client = AsyncHTTPClient()
            requests = (client.fetch('http://localhost:{}/{}'.format(self._server.port, path))
                        for path in shell)
            responses = await cast('Future[Tuple[HTTPResponse]]', gather(*requests))
            shell = ['/{}?v={}'.format(path, response.headers['Etag'].strip('"'))
                     for path, response in zip(shell, responses)]
            _BuildManifest._manifest = {'shell': shell, 'debug': self._server.debug} # type: ignore

        self.set_header('Content-Type', 'text/javascript')
        self.write('micro.service.MANIFEST = {};\n'.format(json.dumps(self._manifest)))
Ejemplo n.º 12
0
def main():
    from tornado.options import define, options, parse_command_line
    define("print_headers", type=bool, default=False)
    define("print_body", type=bool, default=True)
    define("follow_redirects", type=bool, default=True)
    define("validate_cert", type=bool, default=True)
    args = parse_command_line()
    client = HTTPClient()
    for arg in args:
        try:
            response = client.fetch(
                arg,
                follow_redirects=options.follow_redirects,
                validate_cert=options.validate_cert,
            )
        except HTTPError as e:
            if e.response is not None:
                response = e.response
            else:
                raise
        if options.print_headers:
            print(response.headers)
        if options.print_body:
            print(response.body)
    client.close()
Ejemplo n.º 13
0
	def post(self,nick):
		if self.get_argument("option")!="yes":
                                self.redirect("/")
		if nick != self.current_user.decode():
			client = tornado.httpclient.AsyncHTTPClient()
			try:
				response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
			except Exception as e:
				self.redirect("/")
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/user/"+nick,method='DELETE')	
		except Exception as e:
			self.redirect("/")
		if nick == self.current_user.decode():
			self.redirect("/logout")
Ejemplo n.º 14
0
	def post(self,fnr,tnr,pnr):
		client = tornado.httpclient.AsyncHTTPClient()
		admin=0;
		oldval=""
		try:
			response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
			admin=1;
		except Exception as e:
			#self.redirect("/")
			pass

		if admin !=2:
			try:
				response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topic/"+tnr+"/post/"+pnr)
				lista = str(response.body)
				lista=lista.replace('<br>','')
				lista=lista.replace('\'','')
				#lista=lista[1:]
				listaw = lista.split('\\t')
				#print(listaw[7])
				if listaw[5]==self.current_user.decode(): 
					admin=1;
			except Exception as e:
				raise e
				pass
		if admin ==0:
			self.redirect("/")
			return
#przeslane dane czy sa puste
		if ( len(self.get_argument("value",default=""))<1):
			self.render("strony/postChangeData.html",title="no cos mojego z pythona",nick=self.current_user,fnr=fnr,tnr=tnr,pnr=pnr,oldval=self.get_argument("value",default=""))
			return
# post		
# PUT
		post_data_final = {'value': str(self.get_argument("value"))}
		body_final = urllib.parse.urlencode(post_data_final)
		headerss = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			print("asdd");
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topic/"+tnr+"/post/"+pnr,method='PUT',headers=headerss,body=body_final)
		except Exception as e:
			raise e
			print("asdddddddddddddddddddd")
			self.redirect("/forum/"+fnr+"/topic/"+tnr)
			return
		self.redirect("/forum/"+fnr)
Ejemplo n.º 15
0
	def get(self,nickurl):
		if nickurl != self.current_user:
			client = tornado.httpclient.AsyncHTTPClient()
			try:
				response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
			except Exception as e:
				self.redirect("/")
			try:
				response = yield client.fetch("http://192.168.1.21:8888/user/"+str(nickurl))
			except Exception as e:
				self.redirect("/")
			lista = str(response.body)
			lista=lista.replace('<br>','')
			lista=lista.replace('\'','')
			lista=lista[1:]
			listawyn = lista.split('\\t')
		self.render("strony/userChangeData.html",title="no cos mojego z pythona",nick=self.current_user,oldnick=listawyn[0],oldname=listawyn[1],oldname2=listawyn[2],oldmail=listawyn[3])
Ejemplo n.º 16
0
	def get(self):
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
		except Exception as e:
			self.redirect("/")
			return
		self.render("strony/forumChangeData.html",title="no cos mojego z pythona",nick=self.current_user,oldtopic="",olddescri="")
Ejemplo n.º 17
0
	def get(self,fnr):
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
		except Exception as e:
			self.redirect("/")
			return
		try:
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+str(fnr))
		except Exception as e:
			self.redirect("/")
			return
		lista = str(response.body)
		lista=lista.replace('<br>','')
		lista=lista.replace('\'','')
		lista=lista[1:]
		listawyn = lista.split('\\t')
		self.render("strony/forumChangeData.html",title="no cos mojego z pythona",nick=self.current_user,oldtopic=listawyn[2],olddescri=listawyn[4])
Ejemplo n.º 18
0
	def get(self,fnr,tnr):
		client = tornado.httpclient.AsyncHTTPClient()
		admin=0;
		topicname=""
		topicdesc=""
		topicval=""
		try:
			response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
			admin=1;
		except Exception as e:
			#self.redirect("/")
			pass

		if admin !=2:
			try:
				response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topic/"+tnr)
				lista = str(response.body)
				lista=lista.replace('<br>','')
				lista=lista.replace('\'','')
				lista=lista[1:]
				listaw = lista.split('\\t')
				topicname=listaw[3]
				topicdesc=listaw[5]
				topicval=listaw[6]
				#print(listaw[7])
				if listaw[7]==self.current_user.decode(): 
					admin=1;
			except Exception as e:
				pass
		if admin ==0:
			self.redirect("/")
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr)	
		except Exception as e:
	        	self.redirect("/")
#			return
		lista = str(response.body)
		lista=lista.replace('<br>','')
		lista=lista.replace('\'','')
		lista=lista[1:]
		listaw = lista.split('\\t')
		topic = listaw[2]
		self.render("strony/topicAdd.html",title="no cos mojego z pythona",nick=self.current_user,oldtopic=topicname,olddescri=topicdesc,oldvalue=topicval,topic=topic,fnr=fnr)
Ejemplo n.º 19
0
	def post(self,fnr,tnr):
## dostaje unr
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/user/"+str(self.current_user.decode()))
		except Exception as e:
			self.redirect("/")
			return
		lista = str(response.body)
		lista=lista.replace('\'','')
		lista=lista[1:]
		listaw = lista.split('\\t')
		unr=listaw[4]
#przeslane dane czy sa puste
		if ( len(self.get_argument("value",default=""))<1):
			self.redirect("/forum/"+fnr+"/topic/"+tnr)
			return
# post		
		post_data_u = { 'uid': unr }
		body_u = urllib.parse.urlencode(post_data_u)
		try:
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topic/"+tnr,method='POST',body=body_u)
		except Exception as e:
			raise e
			print("asd");
			self.redirect("/")
			return
		print(response.body.decode())
		#return
# PUT
		post_data_final = {'value': str(self.get_argument("value"))}
		body_final = urllib.parse.urlencode(post_data_final)
		headerss = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			print("asdd");
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topic/"+tnr+"/post/"+response.body.decode(),method='PUT',headers=headerss,body=body_final)
		except Exception as e:
			raise e
			print("asdddddddddddddddddddd")
			self.redirect("/forum/"+fnr+"/topic/"+tnr)
			return
		self.redirect("/forum/"+fnr)
Ejemplo n.º 20
0
	def on_message(self,message):
#		if not self.get_secure_cookie("user"):
		if not self.current_user:
			print("login")
			return
		if(len(message)<1):
			print("mess")
			return
# pobieranie unr
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/user/"+str(self.current_user.decode()))
		except Exception as e:
			return
		lista = str(response.body)
		lista=lista.replace('\'','')
		lista=lista[1:]
		listaw = lista.split('\\t')
		unr=listaw[4]
		print(unr)
#ok koniec unr
		post_data_final = {'uid': unr,'value': message}
		body_final = urllib.parse.urlencode(post_data_final)
		headerss = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			print("asdd");
			response = yield client.fetch("http://192.168.1.21:8888/chat",method='POST',headers=headerss,body=body_final)
			lista = str(response.body)
			lista=lista.replace('<br>','')
			lista=lista.replace('\'','')
			lista=lista[1:]
			listaw = lista.split('\\n')
			for a in listaw:
				if len(a)>0:
					for k in ChatHandler.klienci:
						k.write_message(a)
		except Exception as e:
			raise e
		
		print("next")
Ejemplo n.º 21
0
	def get(self,fnr):
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr)	
		except Exception as e:
	        	self.redirect("/")
#			return
		lista = str(response.body)
		lista=lista.replace('<br>','')
		lista=lista.replace('\'','')
		lista=lista[1:]
		listaw = lista.split('\\t')
		topic = listaw[2]
		self.render("strony/topicAdd.html",title="no cos mojego z pythona",nick=self.current_user,oldtopic="",olddescri="",oldvalue="",topic=topic,fnr=fnr)
Ejemplo n.º 22
0
	def get(self):
		#if nick != self.current_user:
		#	serf.redirect('/')
		client = tornado.httpclient.AsyncHTTPClient()
		response = yield client.fetch("http://192.168.1.21:8888/subforums")	
		lista = str(response.body)
		lista=lista.replace('<br>','')
		lista=lista.replace('\'','')
		lista=lista[1:]
		listaw = lista.split('\\n')
		listawyn = []
		for a in listaw:
			listawyn.append(a.split('\\t'))
		admin=0
		try:
			client = tornado.httpclient.AsyncHTTPClient()
			response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
			admin=1
		except Exception as e:
			admin=0
#				self.write(e)o	
		finally:
			self.render("strony/forumList.html",title="no cos mojego z pythona",nick=self.current_user,danen=listawyn,admin=admin)
Ejemplo n.º 23
0
	def get(self,nickurl):
		#if nick != self.current_user:
		#	serf.redirect('/')
		client = tornado.httpclient.AsyncHTTPClient()
		response = yield client.fetch("http://192.168.1.21:8888/user/"+nickurl)	
		lista = str(response.body)
		lista=lista.replace('<br>','')
		lista=lista.replace('\'','')
		lista=lista[1:]
		listawyn = lista.split('\\t')
		owner=1
		if nickurl != self.current_user.decode():
			client = tornado.httpclient.AsyncHTTPClient()
			try:
				response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
				owner=1
			except Exception as e:
				owner=0
#				self.write(e)o	
			finally:
				self.render("strony/userPage.html",title="no cos mojego z pythona",nick=self.current_user,danen=listawyn,choseuser=nickurl,owner=owner)
		else:
			self.render("strony/userPage.html",title="no cos mojego z pythona",nick=self.current_user,danen=listawyn,choseuser=nickurl,owner=owner)
Ejemplo n.º 24
0
	def open(self):
		print("nie")
		#klienci.append(self)
		ChatHandler.klienci.append(self)
		print("cos")
		client = tornado.httpclient.AsyncHTTPClient()
		response = yield client.fetch("http://192.168.1.21:8888/chat")	
		lista = str(response.body)
		lista=lista.replace('<br>','')
		lista=lista.replace('\'','')
		lista=lista[1:]
		listaw = lista.split('\\n')
		for a in listaw:
			if len(a)>0:
				self.write_message(a)
Ejemplo n.º 25
0
def main():
    from tornado.options import define, options, parse_command_line
    define("print_headers", type=bool, default=False)
    define("print_body", type=bool, default=True)
    define("follow_redirects", type=bool, default=True)
    args = parse_command_line()
    client = HTTPClient()
    for arg in args:
        try:
            response = client.fetch(arg,
                                    follow_redirects=options.follow_redirects)
        except HTTPError as e:
            if e.response is not None:
                response = e.response
            else:
                raise
        if options.print_headers:
            print(response.headers)
        if options.print_body:
            print(response.body)
    client.close()
Ejemplo n.º 26
0
	def get(self,fnr,tnr,page):
		#if nick != self.current_user:
		#	serf.redirect('/')
		admin=0
		topic=""
		topicname=""
		client = tornado.httpclient.AsyncHTTPClient()
		response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topics/"+page)	
		lista = str(response.body)
		print(lista)
		lista=lista.replace('<br>','')
		lista=lista.replace('\'','')
		lista=lista[1:]
		listaw = lista.split('\\n')
		listawyn = []
		for a in listaw:
			listawyn.append(a.split('\\t'))
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topic/"+tnr)
			lista = str(response.body)
			lista=lista.replace('<br>','')
			lista=lista.replace('\'','')
			lista=lista[1:]
			listaw = lista.split('\\t')
			topicname=listaw[3]
			topicid=listaw[0]
			topicdesc=listaw[5]
			topicval=listaw[6]
			topicnick=listaw[7]
			topicimie=listaw[8]
			topicnazwisko=listaw[9]
			#print(listaw[7])
		except Exception as e:
			self.redirect("/forum/"+fnr+"/topics")
			pass
		try:
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr)	
			lista = str(response.body)
			lista=lista.replace('<br>','')
			lista=lista.replace('\'','')
			lista=lista[1:]
			listaw = lista.split('\\t')
			forum = listaw[2]
		except Exception as e:
	        	self.redirect("/")
#			return
		admin=0
		try:
			client = tornado.httpclient.AsyncHTTPClient()
			response = yield client.fetch("http://192.168.1.21:8888/admin/"+str(self.current_user.decode()))
			admin=1
		except Exception as e:
			admin=0
#				self.write(e)o	
		client = tornado.httpclient.AsyncHTTPClient()
		try:
			response = yield client.fetch("http://192.168.1.21:8888/subforum/"+fnr+"/topic/"+tnr+"/"+page)
			lista = str(response.body)
			lista=lista.replace('<br>','')
			lista=lista.replace('\'','')
			lista=lista[1:]
			listaw = lista.split('\\n')
			listawyn = []
			for a in listaw:
				listawyn.append(a.split('\\t'))
	#print(listaw[7])
		except Exception as e:
			self.redirect("/forum/"+fnr+"/topics")
			pass
		self.render("strony/postsList.html",title="no cos mojego z pythona",nick=self.current_user,forum=forum,topic=topicname,topicdesc=topicdesc,topicval=topicval,fnr=fnr,danen=listawyn,admin=admin,topicnick=topicnick,topicimie=topicimie,topicnazwisko=topicnazwisko,tnr=tnr,topicid=topicid)