Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

This short tutorial shows how to retrieve data from the staging service with python and requests.

For IDL you can take a similar rout by adapting these instructions to Access to REST-Services in IDL.

Routes

First of all we have to know which routes to use. For this, it is recommended to take a look at the swagger ui (http://localhost:8005/ui/).

 

 

For this tutorial we will only use one route to retrieve all available SWPC events.

  • /swpc_event/list

Requests

The route in question is a GET route which requires to be called with a GET request. To create simple get requests we recommend the python package requests.

A GET request needs only a single parameter: The address which is given by the route.

r = requests.get("http://httpbin.org/get")

Implementation

Retrieve

For retrieving all SWPC events which are stored within the database we can use a GET request with the address given above.

# retrieving data
print('downloading all data...')
swpc_events = requests.get("http://localhost:8005/swpc_event/list").json()

print(swpc_events)

Source Code

Here you can download the full python source code.

staging_request_ingest.py

  • No labels