Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.
/ drapion Public archive

Drapion is a simple python library for parsing web API's

License

Notifications You must be signed in to change notification settings

giancarlopro/drapion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drapion

Drapion is a simple python library for parsing web API's

Installation

python setup.py install

Usage

Using Drapion with Telegram Bot API

from drapion import Drapion

bot = Drapion('https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/')

res = bot.getMe() # will create a object with the response from
                  # https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/getMe
                  # Let's say this is the response
                  # {
                  #   "ok":true,
                  #   "result":{
                  #     "id":111111111,
                  #     "is_bot":true,
                  #     "first_name":"examplebot",
                  #     "username":"examplebot"
                  #   }
                  # }

if res.ok:
  info = res.result
  
  info.id        # 111111111
  info.is_bot    # True
  info.first_name # 'examplebot'
  info.username  # 'examplebot'
  
bot.sendMessage(chat_id='@example', text='Sample') # calls /sendMessage?chat_id=@example&text=Sample
                                                   # returns a object from json response

About

Drapion is a simple python library for parsing web API's

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages