diff --git a/README.md b/README.md
index 1b341a9..b9bac95 100755
--- a/README.md
+++ b/README.md
@@ -2,9 +2,7 @@
=========
[![Build Status](https://travis-ci.org/josuebrunel/myql.svg?branch=master)](https://travis-ci.org/josuebrunel/myql) [![Documentation Status](https://readthedocs.org/projects/myql/badge/?version=latest)](https://myql.readthedocs.org)
-
-[![Join the chat at https://gitter.im/josuebrunel/myql](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/josuebrunel/myql?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Code Issues](https://www.quantifiedcode.com/project/gh:josuebrunel:myql/badge.svg)](https://www.quantifiedcode.com/app/project/gh:josuebrunel:myql)
-
+ [![Code Issues](https://www.quantifiedcode.com/project/gh:josuebrunel:myql/badge.svg)](https://www.quantifiedcode.com/app/project/gh:josuebrunel:myql)
[![PyPI](https://img.shields.io/pypi/v/myql.svg?style=flat)](https://pypi.python.org/pypi/myql)
[![PyPI](https://img.shields.io/pypi/dm/myql.svg?style=flat)](https://pypi.python.org/pypi/myql)
[![PyPI](https://img.shields.io/pypi/l/myql.svg?style=flat)](https://pypi.python.org/pypi/myql)
@@ -53,32 +51,14 @@ $ pip install myql
Quick Start
===========
-```python
->>> import myql
->>> yql = myql.MYQL()
->>> yql.diagnostics = True # To turn diagnostics on
-```
+It's important to know that **response** is a just **requests.models.Response** object.
+Yes indeed, ***mYQL*** uses ***requests*** :smile:
-####Disable access to community tables
-
-```python
->>> rep = yql.rawQuery('desc yahoo.finance.quotes ')
->>> rep.json()
-{u'query': {u'count': 1, u'lang': u'en-US', u'results': {u'table': {u'src': u'http://www.datatables.org/yahoo/finance/yahoo.finance.quotes.xml', u'hash': u'061616a1c033ae89aaf2cbe83790b979', u'name': u'yahoo.finance.quotes', u'request': {u'select': {u'key': {u'required': u'true', u'type': u'xs:string', u'name': u'symbol'}}}, u'meta': {u'sampleQuery': u'\n\t\t\tselect * from yahoo.finance.quotes where symbol in ("YHOO","AAPL","GOOG","MSFT")\n\t\t'}, u'security': u'ANY'}}, u'created': u'2014-08-24T11:26:48Z'}}
->>>
->>> yql.community= True # Setting up access to community
->>> yql = myql.MYQL()
->>> rep = yql.rawQuery('desc yahoo.finance.quotes ')
->>> rep.json()
-{u'error': {u'lang': u'en-US', u'description': u'No definition found for Table yahoo.finance.quotes'}}
-
-```
-or
+By default, you have access to the **community tables**. If for whatsoever reason you would like to not have access to those tables
```python
>>> import myql
>>> yql = myql.MYQL(community=False)
->>> # do your magic
```
####Changing response format (xml or json)
@@ -87,13 +67,120 @@ The response format is by default ***json***.
```python
>>> import myql
+>>> from myql.utils import pretty_json, pretty_xml
>>> yql = myql.MYQL(format='xml', community=True)
->>> rep = yql.rawQuery('select name, woeid from geo.states where place="Congo"')
->>> rep.text
-u'\nCuvette-Ouest Department55998384Cuvette Department2344968Plateaux District2344973Sangha2344974Lekoumou2344970Pool Department2344975Likouala Department2344971Niari Department2344972Brazzaville2344976Bouenza Department2344967Kouilou2344969\n\n'
->>> rep = yql.rawQuery('select name, woeid from geo.states where place="Congo"', format='json')
->>> rep.json()
-{u'query': {u'count': 11, u'lang': u'en-US', u'results': {u'place': [{u'woeid': u'55998384', u'name': u'Cuvette-Ouest Department'}, {u'woeid': u'2344968', u'name': u'Cuvette Department'}, {u'woeid': u'2344973', u'name': u'Plateaux District'}, {u'woeid': u'2344974', u'name': u'Sangha'}, {u'woeid': u'2344970', u'name': u'Lekoumou'}, {u'woeid': u'2344975', u'name': u'Pool Department'}, {u'woeid': u'2344971', u'name': u'Likouala Department'}, {u'woeid': u'2344972', u'name': u'Niari Department'}, {u'woeid': u'2344976', u'name': u'Brazzaville'}, {u'woeid': u'2344967', u'name': u'Bouenza Department'}, {u'woeid': u'2344969', u'name': u'Kouilou'}]}, u'created': u'2014-08-27T04:52:38Z'}}
+>>> resp = yql.rawQuery('select name, woeid from geo.states where place="Congo"')
+>>> print(pretty_xml(resp.content))
+
+
+
+
+ Cuvette-Ouest Department
+ 55998384
+
+
+ Cuvette Department
+ 2344968
+
+
+ Plateaux District
+ 2344973
+
+
+ Sangha
+ 2344974
+
+
+ Lekoumou
+ 2344970
+
+
+ Pool Department
+ 2344975
+
+
+ Likouala Department
+ 2344971
+
+
+ Niari Department
+ 2344972
+
+
+ Brazzaville
+ 2344976
+
+
+ Bouenza Department
+ 2344967
+
+
+ Kouilou
+ 2344969
+
+
+
+
+
+
+>>> resp = yql.rawQuery('select name, woeid from geo.states where place="Congo"', format='json')
+>>> print(pretty_json(resp.content))
+{
+ "query": {
+ "count": 11,
+ "created": "2015-06-07T11:58:20Z",
+ "lang": "en-US",
+ "results": {
+ "place": [
+ {
+ "name": "Cuvette-Ouest Department",
+ "woeid": "55998384"
+ },
+ {
+ "name": "Cuvette Department",
+ "woeid": "2344968"
+ },
+ {
+ "name": "Plateaux District",
+ "woeid": "2344973"
+ },
+ {
+ "name": "Sangha",
+ "woeid": "2344974"
+ },
+ {
+ "name": "Lekoumou",
+ "woeid": "2344970"
+ },
+ {
+ "name": "Pool Department",
+ "woeid": "2344975"
+ },
+ {
+ "name": "Likouala Department",
+ "woeid": "2344971"
+ },
+ {
+ "name": "Niari Department",
+ "woeid": "2344972"
+ },
+ {
+ "name": "Brazzaville",
+ "woeid": "2344976"
+ },
+ {
+ "name": "Bouenza Department",
+ "woeid": "2344967"
+ },
+ {
+ "name": "Kouilou",
+ "woeid": "2344969"
+ }
+ ]
+ }
+ }
+}
+
>>>
```
@@ -113,8 +200,58 @@ Returns table description
```python
>>> response = yql.desc('weather.forecast')
->>> response.json()
-{u'query': {u'count': 1, u'lang': u'en-US', u'results': {u'table': {u'request': {u'select': [{u'key': [{u'required': u'true', u'type': u'xs:string', u'name': u'location'}, {u'type': u'xs:string', u'name': u'u'}]}, {u'key': [{u'required': u'true', u'type': u'xs:string', u'name': u'woeid'}, {u'type': u'xs:string', u'name': u'u'}]}]}, u'security': u'ANY', u'meta': {u'documentationURL': u'http://developer.yahoo.com/weather/', u'sampleQuery': u'select * from weather.forecast where woeid=2502265', u'description': u'Weather forecast table', u'author': u'Yahoo! Inc'}, u'hash': u'aae78b1462a6a8fbc748aec4cf292767', u'name': u'weather.forecast'}}, u'created': u'2014-08-16T19:31:51Z'}}
+>>> print(pretty_json(response.content))
+{
+ "query": {
+ "count": 1,
+ "created": "2015-06-07T12:00:27Z",
+ "lang": "en-US",
+ "results": {
+ "table": {
+ "hash": "aae78b1462a6a8fbc748aec4cf292767",
+ "meta": {
+ "author": "Yahoo! Inc",
+ "description": "Weather forecast table",
+ "documentationURL": "http://developer.yahoo.com/weather/",
+ "sampleQuery": "select * from weather.forecast where woeid=2502265"
+ },
+ "name": "weather.forecast",
+ "request": {
+ "select": [
+ {
+ "key": [
+ {
+ "name": "location",
+ "required": "true",
+ "type": "xs:string"
+ },
+ {
+ "name": "u",
+ "type": "xs:string"
+ }
+ ]
+ },
+ {
+ "key": [
+ {
+ "name": "woeid",
+ "required": "true",
+ "type": "xs:string"
+ },
+ {
+ "name": "u",
+ "type": "xs:string"
+ }
+ ]
+ }
+ ]
+ },
+ "security": "ANY"
+ }
+ }
+ }
+}
+
>>>
```
@@ -127,25 +264,52 @@ Allows you to directly type your query
>>> # deal with the response
```
-####select(table, fields, limit).where(filters, ...)
-Select a table i.e *weather.forecast*.
-If *table* not provided, it will use the default table. If there's no such thing as a default table, it will raise a *NoTableSelectedError*
+####select(table, fields, limit).where(filters, ...)
***NB*** : A simple select doesn't return any data. Use ***GET*** instead.
```python
->>> response = yql.select('geo.countries', [name, code, woeid]).where(['name', '=', 'Canada'])
->>> response.json()
-{u'query': {u'count': 1, u'lang': u'en-US', u'results': {u'place': {u'woeid': u'23424775', u'name': u'Canada'}}, u'created': u'2014-08-16T19:04:08Z'}}
+>>> response = yql.select('geo.countries', ['name', 'code', 'woeid']).where(['name', '=', 'Canada'])
+>>> print(pretty_json(response.content))
+{
+ "query": {
+ "count": 1,
+ "created": "2015-06-07T12:10:39Z",
+ "lang": "en-US",
+ "results": {
+ "place": {
+ "name": "Canada",
+ "woeid": "23424775"
+ }
+ }
+ }
+}
+
>>> ...
->>> rep = yql.select('geo.countries', ['name', 'woeid'], 2).where(['place', '=', 'Africa'])
->>> rep.json()
-{u'query': {u'count': 2, u'lang': u'en-US', u'results': {u'place': [{u'woeid': u'23424740', u'name': u'Algeria'}, {u'woeid': u'23424745', u'name': u'Angola'}]}, u'created': u'2014-08-17T10:52:49Z'}}
->>>
->>> rep = yql.select('geo.countries', ['name', 'woeid'], 2).where(['place', 'in', ('Africa', 'Europe')])
->>> rep.json()
-{u'query': {u'count': 2, u'lang': u'en-US', u'results': {u'place': [{u'woeid': u'23424740', u'name': u'Algeria'}, {u'woeid': u'23424745', u'name': u'Angola'}]}, u'created': u'2014-08-17T11:22:49Z'}}
+>>> response = yql.select('geo.countries', ['name', 'woeid'], 2).where(['place', 'in', ('Africa', 'Europe')])
+>>> from myql.utils import dump
+>>> dump(response)
+{
+ "query": {
+ "count": 2,
+ "created": "2015-06-07T12:27:04Z",
+ "lang": "en-US",
+ "results": {
+ "place": [
+ {
+ "name": "Algeria",
+ "woeid": "23424740"
+ },
+ {
+ "name": "Angola",
+ "woeid": "23424745"
+ }
+ ]
+ }
+ }
+}
+
>>>
```
@@ -155,9 +319,23 @@ Same as ***SELECT***, but instead returns data.
**REMINDER** : Some tables require a **where clause**, therefore ***GET*** won't work on those tables, use *select(...).where(...)* instead .
```python
->>> yql.get('geo.countries', ['name', 'woeid'], 1)
->>> rep.json()
-{u'query': {u'count': 1, u'lang': u'en-US', u'results': {u'place': {u'woeid': u'23424966', u'name': u'Sao Tome and Principe'}}, u'created': u'2014-08-17T10:32:25Z'}}
+>>> from myql.utils import dump
+>>> response = yql.get('geo.countries', ['name', 'woeid'], 1)
+>>> dump(response)
+{
+ "query": {
+ "count": 1,
+ "created": "2015-06-07T12:29:01Z",
+ "lang": "en-US",
+ "results": {
+ "place": {
+ "name": "Sao Tome and Principe",
+ "woeid": "23424966"
+ }
+ }
+ }
+}
+
>>>
```
@@ -222,9 +400,9 @@ Delete records
```
-####Using OAuth to fetch protected resources
+####Using OAuth
-***mYQL*** comes with ***[yahoo_oauth](https://pypi.python.org/pypi/myql)***, which is an OAuth library for Yahoo! APIs
+***mYQL*** comes with ***[yahoo_oauth](https://pypi.python.org/pypi/myql)***, which is an OAuth library for Yahoo! APIs.
```python
>>> from yahoo_oauth import OAuth1
@@ -243,6 +421,7 @@ Delete records
* Fixed issue related to date in StockRetriver.get_historical_info [#107](https://github.com/josuebrunel/myql/issues/107)
* Fixed issue with **IN** condition in **where** clause [#106](https://github.com/josuebrunel/myql/issues/107)
* Fix definition of raw_input for python3 [#105](https://github.com/josuebrunel/myql/issues/105)
+* Yahoo-OAuth included as main oauth library [#112](https://github.com/josuebrunel/myql/issues/112)
##### 1.2.2
-------
diff --git a/docs/index.md b/docs/index.md
index f4f8bf9..c0c9c95 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -3,8 +3,7 @@ mYQL
mYQL is a Python wrapper of the Yahoo Query Language.
-Yahoo! Query Language Documentation and Support
-===============================================
+## Yahoo! Query Language Documentation and Support
* [Yahoo! Query Language](http://developer.yahoo.com/yql/)
* [Yahoo! Developer Network](http://developer.yahoo.com)
@@ -22,47 +21,136 @@ $ pip install myql
Quick Start
===========
-```python
->>> import myql
->>> yql = myql.MYQL()
->>> yql.diagnostics = True # To turn diagnostics on
-```
-
-####Disable access to community tables
+It's important to know that **response** is a just **requests.models.Response** object.
+Yes indeed, ***mYQL*** uses ***requests*** :smile:
-```python
->>> rep = yql.rawQuery('desc yahoo.finance.quotes ')
->>> rep.json()
-{u'query': {u'count': 1, u'lang': u'en-US', u'results': {u'table': {u'src': u'http://www.datatables.org/yahoo/finance/yahoo.finance.quotes.xml', u'hash': u'061616a1c033ae89aaf2cbe83790b979', u'name': u'yahoo.finance.quotes', u'request': {u'select': {u'key': {u'required': u'true', u'type': u'xs:string', u'name': u'symbol'}}}, u'meta': {u'sampleQuery': u'\n\t\t\tselect * from yahoo.finance.quotes where symbol in ("YHOO","AAPL","GOOG","MSFT")\n\t\t'}, u'security': u'ANY'}}, u'created': u'2014-08-24T11:26:48Z'}}
->>>
->>> yql.community= True # Setting up access to community
->>> yql = myql.MYQL()
->>> rep = yql.rawQuery('desc yahoo.finance.quotes ')
->>> rep.json()
-{u'error': {u'lang': u'en-US', u'description': u'No definition found for Table yahoo.finance.quotes'}}
-
-```
-or
+By default, you have access to the **community tables**. If for whatsoever reason you would like to not have access to those tables
```python
>>> import myql
>>> yql = myql.MYQL(community=False)
->>> # do your magic
```
-####Changing response format (xml or json)
+#### Response format (xml or json)
The response format is by default ***json***.
```python
>>> import myql
+>>> from myql.utils import pretty_json, pretty_xml
>>> yql = myql.MYQL(format='xml', community=True)
->>> rep = yql.rawQuery('select name, woeid from geo.states where place="Congo"')
->>> rep.text
-u'\nCuvette-Ouest Department55998384Cuvette Department2344968Plateaux District2344973Sangha2344974Lekoumou2344970Pool Department2344975Likouala Department2344971Niari Department2344972Brazzaville2344976Bouenza Department2344967Kouilou2344969\n\n'
->>> rep = yql.rawQuery('select name, woeid from geo.states where place="Congo"', format='json')
->>> rep.json()
-{u'query': {u'count': 11, u'lang': u'en-US', u'results': {u'place': [{u'woeid': u'55998384', u'name': u'Cuvette-Ouest Department'}, {u'woeid': u'2344968', u'name': u'Cuvette Department'}, {u'woeid': u'2344973', u'name': u'Plateaux District'}, {u'woeid': u'2344974', u'name': u'Sangha'}, {u'woeid': u'2344970', u'name': u'Lekoumou'}, {u'woeid': u'2344975', u'name': u'Pool Department'}, {u'woeid': u'2344971', u'name': u'Likouala Department'}, {u'woeid': u'2344972', u'name': u'Niari Department'}, {u'woeid': u'2344976', u'name': u'Brazzaville'}, {u'woeid': u'2344967', u'name': u'Bouenza Department'}, {u'woeid': u'2344969', u'name': u'Kouilou'}]}, u'created': u'2014-08-27T04:52:38Z'}}
+>>> resp = yql.rawQuery('select name, woeid from geo.states where place="Congo"')
+>>> print(pretty_xml(resp.content))
+
+
+
+
+ Cuvette-Ouest Department
+ 55998384
+
+
+ Cuvette Department
+ 2344968
+
+
+ Plateaux District
+ 2344973
+
+
+ Sangha
+ 2344974
+
+
+ Lekoumou
+ 2344970
+
+
+ Pool Department
+ 2344975
+
+
+ Likouala Department
+ 2344971
+
+
+ Niari Department
+ 2344972
+
+
+ Brazzaville
+ 2344976
+
+
+ Bouenza Department
+ 2344967
+
+
+ Kouilou
+ 2344969
+
+
+
+
+
+
+>>> resp = yql.rawQuery('select name, woeid from geo.states where place="Congo"', format='json')
+>>> print(pretty_json(resp.content))
+{
+ "query": {
+ "count": 11,
+ "created": "2015-06-07T11:58:20Z",
+ "lang": "en-US",
+ "results": {
+ "place": [
+ {
+ "name": "Cuvette-Ouest Department",
+ "woeid": "55998384"
+ },
+ {
+ "name": "Cuvette Department",
+ "woeid": "2344968"
+ },
+ {
+ "name": "Plateaux District",
+ "woeid": "2344973"
+ },
+ {
+ "name": "Sangha",
+ "woeid": "2344974"
+ },
+ {
+ "name": "Lekoumou",
+ "woeid": "2344970"
+ },
+ {
+ "name": "Pool Department",
+ "woeid": "2344975"
+ },
+ {
+ "name": "Likouala Department",
+ "woeid": "2344971"
+ },
+ {
+ "name": "Niari Department",
+ "woeid": "2344972"
+ },
+ {
+ "name": "Brazzaville",
+ "woeid": "2344976"
+ },
+ {
+ "name": "Bouenza Department",
+ "woeid": "2344967"
+ },
+ {
+ "name": "Kouilou",
+ "woeid": "2344969"
+ }
+ ]
+ }
+ }
+}
+
>>>
```
@@ -82,8 +170,58 @@ Returns table description
```python
>>> response = yql.desc('weather.forecast')
->>> response.json()
-{u'query': {u'count': 1, u'lang': u'en-US', u'results': {u'table': {u'request': {u'select': [{u'key': [{u'required': u'true', u'type': u'xs:string', u'name': u'location'}, {u'type': u'xs:string', u'name': u'u'}]}, {u'key': [{u'required': u'true', u'type': u'xs:string', u'name': u'woeid'}, {u'type': u'xs:string', u'name': u'u'}]}]}, u'security': u'ANY', u'meta': {u'documentationURL': u'http://developer.yahoo.com/weather/', u'sampleQuery': u'select * from weather.forecast where woeid=2502265', u'description': u'Weather forecast table', u'author': u'Yahoo! Inc'}, u'hash': u'aae78b1462a6a8fbc748aec4cf292767', u'name': u'weather.forecast'}}, u'created': u'2014-08-16T19:31:51Z'}}
+>>> print(pretty_json(response.content))
+{
+ "query": {
+ "count": 1,
+ "created": "2015-06-07T12:00:27Z",
+ "lang": "en-US",
+ "results": {
+ "table": {
+ "hash": "aae78b1462a6a8fbc748aec4cf292767",
+ "meta": {
+ "author": "Yahoo! Inc",
+ "description": "Weather forecast table",
+ "documentationURL": "http://developer.yahoo.com/weather/",
+ "sampleQuery": "select * from weather.forecast where woeid=2502265"
+ },
+ "name": "weather.forecast",
+ "request": {
+ "select": [
+ {
+ "key": [
+ {
+ "name": "location",
+ "required": "true",
+ "type": "xs:string"
+ },
+ {
+ "name": "u",
+ "type": "xs:string"
+ }
+ ]
+ },
+ {
+ "key": [
+ {
+ "name": "woeid",
+ "required": "true",
+ "type": "xs:string"
+ },
+ {
+ "name": "u",
+ "type": "xs:string"
+ }
+ ]
+ }
+ ]
+ },
+ "security": "ANY"
+ }
+ }
+ }
+}
+
>>>
```
@@ -96,25 +234,52 @@ Allows you to directly type your query
>>> # deal with the response
```
-####select(table, fields, limit).where(filters, ...)
-Select a table i.e *weather.forecast*.
-If *table* not provided, it will use the default table. If there's no such thing as a default table, it will raise a *NoTableSelectedError*
+####select(table, fields, limit).where(filters, ...)
***NB*** : A simple select doesn't return any data. Use ***GET*** instead.
```python
->>> response = yql.select('geo.countries', [name, code, woeid]).where(['name', '=', 'Canada'])
->>> response.json()
-{u'query': {u'count': 1, u'lang': u'en-US', u'results': {u'place': {u'woeid': u'23424775', u'name': u'Canada'}}, u'created': u'2014-08-16T19:04:08Z'}}
+>>> response = yql.select('geo.countries', ['name', 'code', 'woeid']).where(['name', '=', 'Canada'])
+>>> print(pretty_json(response.content))
+{
+ "query": {
+ "count": 1,
+ "created": "2015-06-07T12:10:39Z",
+ "lang": "en-US",
+ "results": {
+ "place": {
+ "name": "Canada",
+ "woeid": "23424775"
+ }
+ }
+ }
+}
+
>>> ...
->>> rep = yql.select('geo.countries', ['name', 'woeid'], 2).where(['place', '=', 'Africa'])
->>> rep.json()
-{u'query': {u'count': 2, u'lang': u'en-US', u'results': {u'place': [{u'woeid': u'23424740', u'name': u'Algeria'}, {u'woeid': u'23424745', u'name': u'Angola'}]}, u'created': u'2014-08-17T10:52:49Z'}}
->>>
->>> rep = yql.select('geo.countries', ['name', 'woeid'], 2).where(['place', 'in', ('Africa', 'Europe')])
->>> rep.json()
-{u'query': {u'count': 2, u'lang': u'en-US', u'results': {u'place': [{u'woeid': u'23424740', u'name': u'Algeria'}, {u'woeid': u'23424745', u'name': u'Angola'}]}, u'created': u'2014-08-17T11:22:49Z'}}
+>>> response = yql.select('geo.countries', ['name', 'woeid'], 2).where(['place', 'in', ('Africa', 'Europe')])
+>>> from myql.utils import dump
+>>> dump(response)
+{
+ "query": {
+ "count": 2,
+ "created": "2015-06-07T12:27:04Z",
+ "lang": "en-US",
+ "results": {
+ "place": [
+ {
+ "name": "Algeria",
+ "woeid": "23424740"
+ },
+ {
+ "name": "Angola",
+ "woeid": "23424745"
+ }
+ ]
+ }
+ }
+}
+
>>>
```
@@ -124,9 +289,23 @@ Same as ***SELECT***, but instead returns data.
**REMINDER** : Some tables require a **where clause**, therefore ***GET*** won't work on those tables, use *select(...).where(...)* instead .
```python
->>> yql.get('geo.countries', ['name', 'woeid'], 1)
->>> rep.json()
-{u'query': {u'count': 1, u'lang': u'en-US', u'results': {u'place': {u'woeid': u'23424966', u'name': u'Sao Tome and Principe'}}, u'created': u'2014-08-17T10:32:25Z'}}
+>>> from myql.utils import dump
+>>> response = yql.get('geo.countries', ['name', 'woeid'], 1)
+>>> dump(response)
+{
+ "query": {
+ "count": 1,
+ "created": "2015-06-07T12:29:01Z",
+ "lang": "en-US",
+ "results": {
+ "place": {
+ "name": "Sao Tome and Principe",
+ "woeid": "23424966"
+ }
+ }
+ }
+}
+
>>>
```
@@ -191,13 +370,30 @@ Delete records
```
-Using OAuth to fetch protected resources
-=========================================
+## Using OAuth
+
+***mYQL*** comes with ***[yahoo_oauth](https://pypi.python.org/pypi/myql)***, which is an OAuth library for Yahoo! APIs.
```python
->>> from myql.contrib.auth import YOAuth
->>> oauth = YOAuth(None, None, from_file='credentials.json') # only consumer_key and consumer_secret are required.
+>>> from yahoo_oauth import OAuth1
+>>> oauth = OAuth1(None, None, from_file='credentials.json') # only consumer_key and consumer_secret are required.
>>> from myql import MYQL
>>> yql = MYQL(format='xml', oauth=oauth)
>>> response = yql.getGUID('josue_brunel') # Deal with the response
```
+
+## Utils
+
+***mYQL*** comes with some useful functions, such as:
+
+#### *prettyty(response, format)*
+ According to the format, call *pretty_json* or *pretty_xml*
+
+#### *pretty_json(response.content)*
+ prettyfy a JSON response content
+
+#### *pretty_xml(response.content)*
+ Prettyfy a XML response content
+
+#### *dump(response)*
+ Print a prettyfied response
diff --git a/docs/oauth.md b/docs/oauth.md
index e5f1afe..ad2a5c9 100644
--- a/docs/oauth.md
+++ b/docs/oauth.md
@@ -1,57 +1,19 @@
-YOAuth as Yahoo OAuth
+Yahoo-OAuth
=====================
-Before going any further i would like to thank [Darren Kempiners](https://github.com/dkempiners) and [Andrew Martin](https://github.com/almartin82) for their help.
+The ***YOAuth*** module is not supported anymore. mYQL comes with
+ ***[Yahoo-OAuth](http://yahoo-oauth.readthedocs.org/en/master/)***.
+ From now on, this will be the library to use to when you want to use **OAuth**.
+ Nothing has really changed anyway, since *yahoo-oauth* is based on *YOAuth*.
-The ***YOAuth*** class is used to generates an oauth *session* which will be used in your requests to the *YQL Service*
-
-### **Definition**
-
-#### *YOAuth(consumer_key, consumer_secret, \*\*kwargs)*
-
-* ***consumer_key*** : Client Key of your application.
-* ***consumer_secret*** : Client Secret of your application
-* ***acess_token*** : The Access Token
-* ***acess_token_secret*** : The Acess Token Secret
-* ***session_handler*** : The OAuth Session Handler which is required when refreshing the token
-* ***from_file*** : File containing the credentials.
-
-The **minimum** information required in a ***credentials file*** are the ***consumer_key*** and the ***consumer_secret***.
-If ***from_file*** is provided, the class will be instanciated with data within this file.
-
-```python
->>> from myql.contrib.auth import YOAuth
->>> oauth = YOAuth('khdhkfhbb7rit93ffhbfh', 'urysfjue76885hgf')
-```
-
-Using a credentials json file
-
-*credentials.json*
-```json
-{
- "consumer_key" : "khdhkfhbb7rit93ffhbfh",
- "consumer_secret": "urysfjue76885hgf"
-}
-```
+You can read the full documentation [here](http://yahoo-oauth.readthedocs.org/en/master/)
```python
->>> oauth = YOAuth(None, None, from_file=os.path.realpath('credentials.json'))
+>>> import myql
+>>> from yahoo_oauth import OAuth1
+>>> oauth = OAuth1(None, None, from_file='credentials.json')
+>>> yql = myql.MYQL(format='xml',oauth=oauth)
+>>> response = yql.getGUID('josue_brunel')
+...
```
-### **Methods**
-
-- #### *OAuth.json_get_data(filename)*
-
-Return a dict containing the credentials
-
-- #### *OAuth.json_write_data(json_data, filename)*
-
-Update the credentials file
-
-- #### *OAuth.token_is_valid()*
-
-Check if the token is still valid
-
-- #### *OAuth.refresh_token()*
-
-Refresh the expired token
\ No newline at end of file
diff --git a/docs/table.md b/docs/table.md
index b62443d..7f0fa9c 100644
--- a/docs/table.md
+++ b/docs/table.md
@@ -162,7 +162,7 @@ This class represents a stored function. Read the full documentation [here](http
As ***Binder***, ***BinderFunction*** is a subclass of ***BaseBinder***. They both share the same methods
-## Using MetaClasses to define a Table
+## The MetaClass API
***BinderModel*** and ***TableModel*** are the only classes to keep in mind here. They're respectively subclasses of ***BinderMeta*** and ***TableMeta***. Those last two help providing a powerful API to define YQL Table.
diff --git a/mkdocs.yml b/mkdocs.yml
index 084b09d..e84cdc5 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -3,12 +3,12 @@ repo_url: https://github.com/josuebrunel/myql
site_url: http://myql.readthedocs.org/en/latest/myql/
site_description: MYQL documentation
site_author: Josue Kouka
-google_analytics: ['UA-32441224-4', 'readthedocs.org']
+google_analytics: ['UA-32441224-4', 'myql.readthedocs.org']
pages:
-- [index.md, Home]
-- [myql.md, MYQL]
-- [stockscraper.md, StockScraper]
-- [oauth.md, YOAuth]
-- [table.md, Open Table]
-- [contrib.md, Contribute]
+- Home : index.md
+- mYQL : myql.md
+- StockScraper : stockscraper.md
+- Yahoo-OAuth : oauth.md
+- Open Tables : table.md
+- Contribute : contrib.md
theme: readthedocs