Skip to content

Instantly share code, notes, and snippets.

@dsuch
Created June 16, 2013 00:40
Show Gist options
  • Save dsuch/5790211 to your computer and use it in GitHub Desktop.
Save dsuch/5790211 to your computer and use it in GitHub Desktop.
from django.template.response import TemplateResponse
def home(req):
# A dictionary of input data read from HTTP GET. If no input was given
# we translate from EUR to HRK.
to = req.GET.get('to', 'HRK')
request = {'from':'EUR', 'to':to}
# Pass the dictionary into the client's invoke method along with the name
# of a service you want to invoke
response = req.zato_client.invoke('exchangerates.get-exchange-rate-list', request)
# response.data has a bunch of attributes that can be fed to the template as is
return TemplateResponse(req, 'rates.html', {'data':response.data['rates'], 'to':to})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment