Permalink
Browse files

clean-up trailing whitespace, fix un-used imports etc

  • Loading branch information...
Stuart Colville
Stuart Colville committed Apr 20, 2012
1 parent 306234f commit 3910b197becd8aaa84d11abbe81aed40f239819f
Showing with 114 additions and 106 deletions.
  1. +1 −0 AUTHORS
  2. +8 −4 CHANGELOG
  3. +1 −1 README
  4. +5 −2 docs/source/index.rst
  5. +7 −4 docs/source/usage.rst
  6. +74 −76 yql/__init__.py
  7. +2 −1 yql/logger.py
  8. +15 −17 yql/storage.py
  9. +1 −1 yql/utils.py
View
@@ -2,4 +2,5 @@
* Cyril Doussin * Cyril Doussin
* Diogo Baeder * Diogo Baeder
* Jannis Leidel
* *YOUR NAME HERE* * *YOUR NAME HERE*
View
@@ -1,3 +1,7 @@
* 0.7.3
* Bugfixes provided by Jannis Leidel
* Fixed examples in docs following flickr tables change requiring api key
* Fixed live tests.
* 0.7.2 * 0.7.2
* Sync versioning in both lib + setup.py * Sync versioning in both lib + setup.py
* 0.7.1 * 0.7.1
@@ -11,7 +15,7 @@
* Add one() method for single results. * Add one() method for single results.
* 0.6.1 * 0.6.1
* Fix `LP:663232 <https://bugs.launchpad.net/bugs/663232>`_ remove setter for Python2.5 compatibility. * Fix `LP:663232 <https://bugs.launchpad.net/bugs/663232>`_ remove setter for Python2.5 compatibility.
* 0.6 * 0.6
* Added changelog. * Added changelog.
* Documentation updates. * Documentation updates.
* Fixes for compatibility with latest oauth * Fixes for compatibility with latest oauth
@@ -27,12 +31,12 @@
* Fix deletions. * Fix deletions.
* Added logging. * Added logging.
* Scheme is now more easily configurable. * Scheme is now more easily configurable.
* 0.4 * 0.4
* Add support for INSERT, UPDATE and DELETE * Add support for INSERT, UPDATE and DELETE
* Update tests * Update tests
* 0.3 * 0.3
* Improve tests and move to returning YQLObjects instead of raw data * Improve tests and move to returning YQLObjects instead of raw data
* 0.2 * 0.2
* Small bug-fixes and test improvements * Small bug-fixes and test improvements
* 0.1 * 0.1
* Initial release * Initial release
View
2 README
@@ -18,7 +18,7 @@ Usage
>>> import yql >>> import yql
>>> y = yql.Public() >>> y = yql.Public()
>>> query = 'select * from flickr.photos.search where text=@text limit 3'; >>> query = 'select * from flickr.photos.search where text=@text and api_key="INSERT_API_KEY_HERE" limit 3';
>>> y.execute(query, {"text": "panda"}) >>> y.execute(query, {"text": "panda"})
View
@@ -28,13 +28,13 @@ Or alternatively:
sudo easy_install yql sudo easy_install yql
The following example shows a simple query using the public endpoint. The following example shows a simple query using the public endpoint. (The API KEY for flickr has been redacted)
.. sourcecode:: python .. sourcecode:: python
>>> import yql >>> import yql
>>> y = yql.Public() >>> y = yql.Public()
>>> query = 'select * from flickr.photos.search where text="panda" limit 3'; >>> query = 'select * from flickr.photos.search where text="panda" and api_key="INSERT_API_KEY_HERE" limit 3';
>>> result = y.execute(query) >>> result = y.execute(query)
>>> result.rows >>> result.rows
[{u'isfamily': u'0', u'title': u'Panda can has fruit', u'farm': u'3', u'ispublic': u'1', u'server': u'2605', u'isfriend': u'0', u'secret': u'62ccb5d94e', u'owner': u'99045337@N00', u'id': u'4135649462'}, {u'isfamily': u'0', u'title': u'Hey Panda', u'farm': u'3', u'ispublic': u'1', u'server': u'2799', u'isfriend': u'0', u'secret': u'1632cb8ab8', u'owner': u'99045337@N00', u'id': u'4134889385'}, {u'isfamily': u'0', u'title': u'Panda Lin Hui', u'farm': u'3', u'ispublic': u'1', u'server': u'2737', u'isfriend': u'0', u'secret': u'099b30a0a4', u'owner': u'37843112@N07', u'id': u'4135631774'}] [{u'isfamily': u'0', u'title': u'Panda can has fruit', u'farm': u'3', u'ispublic': u'1', u'server': u'2605', u'isfriend': u'0', u'secret': u'62ccb5d94e', u'owner': u'99045337@N00', u'id': u'4135649462'}, {u'isfamily': u'0', u'title': u'Hey Panda', u'farm': u'3', u'ispublic': u'1', u'server': u'2799', u'isfriend': u'0', u'secret': u'1632cb8ab8', u'owner': u'99045337@N00', u'id': u'4134889385'}, {u'isfamily': u'0', u'title': u'Panda Lin Hui', u'farm': u'3', u'ispublic': u'1', u'server': u'2737', u'isfriend': u'0', u'secret': u'099b30a0a4', u'owner': u'37843112@N07', u'id': u'4135631774'}]
@@ -45,6 +45,9 @@ The following example shows a simple query using the public endpoint.
Hey Panda Hey Panda
Panda Lin Hui Panda Lin Hui
.. note::
To make a query to Flickr you need to get an API key here: http://www.flickr.com/services/apps/create/apply/.
Contents Contents
-------- --------
View
@@ -46,7 +46,7 @@ For the most part it will make sense to use the :attr:`YQLObj.rows` property to
.. sourcecode:: python .. sourcecode:: python
>>> result = y.execute('select * from flickr.photos.search where text="panda" limit 3') >>> result = y.execute('select * from flickr.photos.search where text="panda" and api_key=INSERT_API_KEY_HERE" limit 3')
>>> result.rows >>> result.rows
[{u'isfamily': u'0', u'title': u'Panda can has fruit', u'farm': u'3', u'ispublic': u'1', u'server': u'2605', u'isfriend': u'0', u'secret': u'62ccb5d94e', u'owner': u'99045337@N00', u'id': u'4135649462'}, {u'isfamily': u'0', u'title': u'Hey Panda', u'farm': u'3', u'ispublic': u'1', u'server': u'2799', u'isfriend': u'0', u'secret': u'1632cb8ab8', u'owner': u'99045337@N00', u'id': u'4134889385'}, {u'isfamily': u'0', u'title': u'Panda Lin Hui', u'farm': u'3', u'ispublic': u'1', u'server': u'2737', u'isfriend': u'0', u'secret': u'099b30a0a4', u'owner': u'37843112@N07', u'id': u'4135631774'}] [{u'isfamily': u'0', u'title': u'Panda can has fruit', u'farm': u'3', u'ispublic': u'1', u'server': u'2605', u'isfriend': u'0', u'secret': u'62ccb5d94e', u'owner': u'99045337@N00', u'id': u'4135649462'}, {u'isfamily': u'0', u'title': u'Hey Panda', u'farm': u'3', u'ispublic': u'1', u'server': u'2799', u'isfriend': u'0', u'secret': u'1632cb8ab8', u'owner': u'99045337@N00', u'id': u'4134889385'}, {u'isfamily': u'0', u'title': u'Panda Lin Hui', u'farm': u'3', u'ispublic': u'1', u'server': u'2737', u'isfriend': u'0', u'secret': u'099b30a0a4', u'owner': u'37843112@N07', u'id': u'4135631774'}]
>>> for row in result.rows: >>> for row in result.rows:
@@ -59,14 +59,17 @@ For the most part it will make sense to use the :attr:`YQLObj.rows` property to
.. note:: .. note::
In version 0.6 this was changed so that if only one row is returned it's still a list so that iterating over the rows is more robust. Prior to version 0.6 results.rows would contain the content of the data.
In version 0.6 this was changed so that if only one row is returned it's still a list so that iterating over the rows is more robust. Prior to version 0.6 results.rows would contain the content of the data. The flickr table requires an API KEY which you can get here http://www.flickr.com/services/apps/create/apply/
To access one result when you know you only have one result use the one() method: To access one result when you know you only have one result use the one() method:
.. sourcecode:: python .. sourcecode:: python
>>> result = y.execute('select * from flickr.photos.search where text="panda" limit 1') >>> result = y.execute('select * from flickr.photos.search where text="panda" and api_key="INSERT_API_KEY_HERE" limit 1')
>>> result.one() >>> result.one()
{u'isfamily': u'0', u'title': u'Panda can has fruit', u'farm': u'3', u'ispublic': u'1', u'server': u'2605', u'isfriend': u'0', u'secret': u'62ccb5d94e', u'owner': u'99045337@N00', u'id': u'4135649462'} {u'isfamily': u'0', u'title': u'Panda can has fruit', u'farm': u'3', u'ispublic': u'1', u'server': u'2605', u'isfriend': u'0', u'secret': u'62ccb5d94e', u'owner': u'99045337@N00', u'id': u'4135649462'}
@@ -106,7 +109,7 @@ Here's an example of using Two-legged authentication in Python YQL.
import yql import yql
y = yql.TwoLegged(API_KEY, SHARED_SECRET) y = yql.TwoLegged(API_KEY, SHARED_SECRET)
y.execute("select * from flickr.photos.search where text='panda' limit 3") y.execute("select * from flickr.photos.search where text='panda' and api_key="INSERT_API_KEY_HERE" limit 3")
Three-legged Auth Three-legged Auth
Oops, something went wrong.

0 comments on commit 3910b19

Please sign in to comment.