GithubHelp home page GithubHelp logo

twitterdoc's Introduction

TwitterDoc

Ever needed a machine-readable format of the Twitter API docs? I did, so I wrote a python script to crawl the HTML of the REST API pages and generate a JSON document describing the API. And just because I care, I also wrote a schema for the schema. (The schema for the schema for the schema is available at json-schema.org).

The script is written for Python 3 and uses the following libraries:

  • beautifulsoup4
  • requests

These will have to be installed (pip install bs4 requests) before the script will run. By default, it'll output a minified JSON document (this is the default behavior of json.JSONEncoder) -- you can pipe the output to python -m json.tool to validate and pretty-print. Example:

python twitterapi.py | python -m json.tool > api.json

The resulting document can be used to help generate API usage code in various languages or alternate/offline documentation of the REST API. Note: the script attempts to infer the types of the REST parameters but may be inaccurate—be sure to manually inspect / test code using that information before deploying.

Support for the twitter Streaming API may be added eventually, but for now the script only outputs the schema for the REST endpoints described on the public REST API page.

twitterdoc's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.