==========
How to use
==========

The following tests are live tests with my UserID. They will ensure, that the
code works against the live Nike+ API.

>>> import sw.nikeplus
>>> user_id = 279218513


Retrieving data in XML
======================

>>> print sw.nikeplus.get_xml(user_id)
<?xml...<status>success...<run id="1889752785" workoutType="standard"><startTime>2006-10-31T16:50:07+01:00...

The response from Nike+ is cached. If, for any reason, the service is
out-of-order on the next try, the old response is returned. You may force a
refresh by providing the optional parameter `force`.


Retrieving data in JSON
=======================

>>> print sw.nikeplus.get_json(user_id)
{'status': 'success',...'startTime': '2006-10-31T16:50:07+01:00', 'duration': '1752873', 'id': '1889752785', 'workoutType': 'standard'...

The response from Nike+ is cached here, too. You can provide the optional
parameter `force` as well, if you like to disable caching.


Helper functions
================

There is a helper function called `xml2json`. It should work with every XML,
not just with the Nike+ one. It is tested inside the package, but may be used
from other packages, if you need it:

>>> import sw.nikeplus.utils
>>> print sw.nikeplus.utils.xml2json(
...     """<?xml version="1.0" encoding="UTF-8"?>
...        <note id="1234">
...          <to>Tove</to>
...          <from>Jani</from>
...          <heading>Reminder</heading>
...          <body>Don't forget me this weekend!</body>
...        </note>""")
{'body': "Don't forget me this weekend!", 'to': 'Tove', 'from': 'Jani', 'heading': 'Reminder', 'id': '1234'}
