Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toapi

Build Python Version License

Make existing web sites available with APIs. You can have your own APIs of your web. You can create your owen APIs from other's web. And Then, you can do something interesting with those APIs.

Feature

  • Convert static html to api.
  • Easy to use.

Installaton

  • pip install toapi
  • pip install git+https://github.com/gaojiuli/toapi/

Usage

from pprint import pprint

from toapi import XPath, Item, Api

api = Api('https://news.ycombinator.com/')

class Post(Item):
    url = XPath('//a[@class="storylink"][1]/@href')
    title = XPath('//a[@class="storylink"][1]/text()')

    class Meta:
        source = XPath('//tr[@class="athing"]')
        route = '/'

api.register(Post)

pprint(api.parse('/'))

api.serve()

Then, You get your api server. Powered by flask.

Contribute

  • Open issue.
  • Pull Request.

License

Apache-2.0

About

Make existing web sites available with APIs.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages