Download Files with zagoload - part 5

Consuming restful api

The json function allows to consume restful api. If the request was successful, the FileRequest.json will contians the parsed json of the response.
 import zagoload

 def find_post_title(id):
   ff = zagoload.json( '{0}'.format(id) )
   return ff.json['title']

 def find_users():
   ff = zagoload.json( '' )
   return [user['username'] for user in ff.json]

 def add_post(postdata = {}):
   ff = zagoload.json('', action='POST', postdata = postdata , cacheMode=zagoload.CacheMode.Disabled )
   return ff.rStatus == 200

 def run():
   print( find_post_title(1)  )
   print( find_users() )
   if add_post({ 'id': 1, 'title': 'foo', 'body': 'bar', 'userId': 1 }):

 run() output
 # python
 sunt aut facere repellat provident occaecati excepturi optio reprehenderit
 ['Bret', 'Antonette', 'Samantha', 'Karianne', 'Kamren', 'Leopoldo_Corkery', 'Elwyn.Skiles', 'Maxime_Nienow', 'Delphine',