Created
June 12, 2018 14:34
-
-
Save CoutinhoElias/7a4481ddbe481579f852ce59b15f881f to your computer and use it in GitHub Desktop.
UrlRequest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.network.urlrequest import UrlRequest | |
from kivy.app import App | |
from kivy.uix.button import Button | |
class reqApp(App): | |
def build(self): | |
bt = Button(text='Pegar Json do Bitcoin') | |
bt.bind(on_press=self.make_request) | |
return bt | |
def make_request(self, instance): | |
#UrlRequest('https://www.mercadobitcoin.net/api/BTC/ticker/', self.print_json) | |
headers = {'Authorization': 'Basic ' + ('%s:%s' % ('elias', '1111qqqq')),'Accept': '*/*'} | |
UrlRequest('http://localhost/api/list_todos', req_headers=headers) | |
print(headers) | |
def print_json(self, req, result): | |
print (result['description']) | |
if __name__ == '__main__': | |
reqApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment