Git Product home page Git Product logo

snooze's Introduction

Note

The notes are for us to show what needs to be done to the code, but it allows you to get excited about the possibilities that are coming

Use

The first step in using any RESTful api is knowing the base site that it is attached to. To add the base site you will need to uses the constructor of Snooze. A base site for github would look like this.

snooze = Snooze('github.com')

Make sure you do not add the http:// or https:// onto the domain. If you want to make it secure just set the secure argument to True. Also if you add the slash to the end of the domain that is ok, we can take it off for you :)

For every slash and command after the base url ("/something") in a restful api you will use a dot and a attribute call for that command (".something").

However you do not have to use that attribute call. You can override that attribute name to be anything you like. An example git hub api could look both ways

github RESTful API:
  http://github.com/api/v2/json/user/show/knobe

snooze api: 
  snooze.api.v2.json.user.show.knobe # great and fast for hard coding
  or
  snooze.api.v2.json.user.show.username['knobe'] # makes it easier to accept user input

Now that you have the url in api you can send the url generated by the api by performing a call on the object your created. By default it sends a post request.

snooze.api.v2.json.user.show.username['knobe'](_method_ = 'get') # sends a get request

You can also specify arguments to be sent in a request. For example lets say your trying to change your email address.

github RESTful API:
  http://github.com/api/v2/json/user/show/knobe
        with post value of:
            values[email]='[email protected]

snooze.api.v2.json.user.show.knobe('post', values={'email':'[email protected]'}) 

Note: This has not been tested

Authenticating a user for github is pretty easy, and the api currently supports it. This is because it is a post variable you need to set and that is it.

For other API's they require inserting things into the the header, which is not implmented yet.

< HOW TO CREATE USER AUTHENTICATION TO INPUT INTO THE HEADER >

Acknowledgments

Mike Verdone and his twitter api, because without his api the idea would not have made it out of my mind.

snooze's People

Contributors

tylerharper avatar

Stargazers

 avatar

Watchers

 avatar  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.