Commits

Rael Max committed 11f3e96

added main app with tkinter

  • Participants
  • Parent commits 5e534fc

Comments (0)

Files changed (2)

File client/app.py

-# -*- coding: utf-8 -*-
-import requests
-
-SERVER = 'http://127.0.0.1:8001/get'
-
-datatype = raw_input('Dados em xml ou json: ')
-limit = raw_input('Quantidade de registros: ')
-
-req_url = '%s/%s/%s' % (SERVER, datatype, limit)
-
-req = requests.get(req_url)
-
-print req.text

File client/main.py

+# -*- coding: utf-8 -*-
+from Tkinter import *
+import requests
+
+SERVER = 'http://127.0.0.1:8001/get'
+
+class App:
+    def __init__(self, master):
+        self.qtd_reqs = 0
+
+        frame = Frame(master)
+        frame.pack()
+
+        self.json = Button(frame, text="Requisitar JSON", command=self.get_json)
+        self.json.pack(side=LEFT)
+
+        self.xml = Button(frame, text="Requisitar XML", command=self.get_xml)
+        self.xml.pack(side=LEFT)
+
+    def get_json(self):
+        req = requests.get('%s/json/1000' % SERVER)
+        print req.text
+
+    def get_xml(self):
+        req = requests.get('%s/xml/1000' % SERVER)
+        print req.text
+
+root = Tk()
+app = App(root)
+root.mainloop()