Skip to content

Commit

Permalink
Added a code example in the index.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
gph03n1x committed Sep 3, 2016
1 parent a6b1d62 commit 3be978a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/source/getLinesAndRoutesForMl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ getLinesAndRoutesForMl

``http://telematics.oasa.gr/api/?act=getLinesAndRoutesForMl&p1=mlcode``


**Response:**

.. code-block:: python
Expand Down
22 changes: 14 additions & 8 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,20 @@ The api has the following form ::
τις παραμέτρους στο url .


Actions:
**Code example: Python**

Χρήση του API μέσω python requests. Το μόνο που αλλάζει είναι το endpoint.

.. code-block:: python
>>> import requests
>>> response = requests.post("http://telematics.oasa.gr/api/?act=getLinesAndRoutesForMl&p1=9")
>>> json_response = response.json()
>>> print(json_response[0]["line_descr"])
'ΠΛΑΤΕΙΑ ΚΑΝΙΓΓΟΣ - ΓΚΥΖH'
**Actions:**

.. toctree::
:maxdepth: 2
Expand All @@ -38,10 +51,3 @@ Actions:
getSchedLines

.. _script: http://telematics.oasa.gr/js/script.js

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

0 comments on commit 3be978a

Please sign in to comment.