-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separating docs in multiple files and improving quickstart
- Loading branch information
1 parent
7ae885a
commit 78fe163
Showing
8 changed files
with
106 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# tapioca-wrapper | ||
|
||
**tapioca** provides an easy way to make explorable python API wrappers. | ||
APIs wrapped by Tapioca follow a simple interaction pattern that works uniformelly so developers don't need to learn how to use a new coding interface/style for each service API. | ||
|
||
Supports Python 2.7, 3.2, 3.3 and 3.4. | ||
|
||
![Tapioca!!](_static/tapioca.jpg "Tapioca") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Contributors | ||
|
||
- André Ericson (<de.ericson@gmail.com>) | ||
- Filipe Ximenes (<filipeximenes@gmail.com>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Available Flavours | ||
|
||
[https://github.com/vintasoftware/tapioca-facebook](https://github.com/vintasoftware/tapioca-facebook) | ||
[https://github.com/vintasoftware/tapioca-twitter](https://github.com/vintasoftware/tapioca-twitter) | ||
## Mandrill | ||
[https://github.com/vintasoftware/tapioca-mandrill](https://github.com/vintasoftware/tapioca-mandrill) | ||
## Parse | ||
[https://github.com/vintasoftware/tapioca-parse](https://github.com/vintasoftware/tapioca-parse) | ||
|
||
### Your flavour | ||
Send a pull request to add new ones to the list. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Wrapping an API with Tapioca | ||
|
||
This is all the code you need to build the Facebook Graph API wrapper you just played with: | ||
``` python | ||
# source here: https://github.com/vintasoftware/tapioca-facebook/blob/master/tapioca_facebook/tapioca_facebook.py | ||
|
||
from tapioca import ( | ||
TapiocaAdapter, generate_wrapper_from_adapter) | ||
from requests_oauthlib import OAuth2 | ||
|
||
from resource_mapping import RESOURCE_MAPPING | ||
|
||
|
||
class FacebookClientAdapter(TapiocaAdapter): | ||
api_root = 'https://graph.facebook.com' | ||
resource_mapping = RESOURCE_MAPPING | ||
|
||
def get_request_kwargs(self, api_params): | ||
client_id = api_params.get('client_id') | ||
return { | ||
'auth': OAuth2(client_id, | ||
token={ | ||
'access_token': api_params.get('access_token'), | ||
'token_type': 'Bearer'}) | ||
} | ||
|
||
def get_iterator_list(self, response_data): | ||
return response_data['data'] | ||
|
||
def get_iterator_next_request_kwargs(self, | ||
iterator_request_kwargs, response_data): | ||
paging = response_data.get('paging') | ||
if not paging: | ||
return | ||
url = paging.get('next') | ||
|
||
if url: | ||
return {'url': url} | ||
|
||
|
||
Facebook = generate_wrapper_from_adapter(FacebookClientAdapter) | ||
``` | ||
Everything else is what we call ```resource_mapping``` and its merely documentation. You can take a look [here](https://github.com/vintasoftware/tapioca-facebook/blob/master/tapioca_facebook/resource_mapping.py). | ||
|
||
**don't forget to add your new flavour to the [list](flavours.md)** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters