Skip to content

Instantly share code, notes, and snippets.

@CoutinhoElias
Created June 12, 2018 14:34
Show Gist options
  • Save CoutinhoElias/7a4481ddbe481579f852ce59b15f881f to your computer and use it in GitHub Desktop.
Save CoutinhoElias/7a4481ddbe481579f852ce59b15f881f to your computer and use it in GitHub Desktop.
UrlRequest
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