Skip to content

Commit

Permalink
Update docs & docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Ray Chen committed Apr 7, 2017
1 parent a889f64 commit 340cd2e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
6 changes: 3 additions & 3 deletions datagovsg_api/datagovsg_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def taxi_availability(self, date_time=None):
, for example: ``2016-12-12T09:45:00``.
Returns:
`Response`` object: Call ``.json()`` to get the json (dict)
A ``Response`` object. Call ``.json()`` to get the json (dict)
representation of the data. E.g. ``taxi_availability().json()``.
The json is a valid GeoJSON.
"""
Expand All @@ -83,7 +83,7 @@ def traffic_images(self, date_time=None):
, for example: ``2016-12-12T09:45:00``.
Returns:
`Response`` object: Call ``.json()`` to get the json (dict)
A ``Response`` object. Call ``.json()`` to get the json (dict)
representation of the data. E.g. ``traffic_images().json()``.
"""
endpoint = 'transport/traffic-images'
Expand Down Expand Up @@ -116,7 +116,7 @@ def weather_forecast(self, duration, date=None, date_time=None):
, for example: ``2016-12-12T09:45:00``.
Returns:
`Response`` object: Call ``.json()`` to get the json (dict)
A ``Response`` object. Call ``.json()`` to get the json (dict)
representation of the data.
E.g. ``weather_forecast(duration='4-day').json()``.
Expand Down
23 changes: 14 additions & 9 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ An API key can be obtained from https://developers.data.gov.sg/.
project does not represent data.gov.sg or it's affiliates in any way.

To report bugs or request for features, use the issue tracker on Github
(https://github.com/half0wl/datagovsg_api). For general enquiries or to get
in touch with the author, e-mail: ray <at> half0wl <dot> com.
(`@half0wl/datagovsg_api <https://github.com/half0wl/datagovsg_api/>`_).

For general enquiries or to get in touch with the author, e-mail: ray
<at> half0wl <dot> com.

**Example usage/demo:**

Expand All @@ -23,17 +25,20 @@ in touch with the author, e-mail: ray <at> half0wl <dot> com.
datagovsg = datagovsg_api.APIClient(API_KEY='your_api_key')
# get taxi availability
datagovsg.taxi_availability() # latest
datagovsg.taxi_availability(date_time='2016-12-12T09:45:00') # for data at specific date/time
taxi_availability = datagovsg.taxi_availability()
assert taxi_availability.status_code == 200 # ensure response is 200 OK
print(taxi_availability.json()) # print the json response
datagovsg.taxi_availability(date_time='2016-12-12T09:45:00').json() # for data at specific date/time
# get traffic images
datagovsg.traffic_images() # latest
datagovsg.traffic_images(date_time='2016-12-12T09:45:00') # for data at specific date/time
datagovsg.traffic_images().json() # latest
datagovsg.traffic_images(date_time='2016-12-12T09:45:00').json() # for data at specific date/time
# get weather forecast
datagovsg.weather_forecast(duration='2-hour')
datagovsg.weather_forecast(duration='24-hour')
datagovsg.weather_forecast(duration='4-day')
datagovsg.weather_forecast(duration='2-hour').json()
datagovsg.weather_forecast(duration='24-hour').json()
datagovsg.weather_forecast(duration='4-day').json()
.. autoclass:: datagovsg_api.APIClient
:members:
Expand Down

0 comments on commit 340cd2e

Please sign in to comment.