Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. from flask_restful import Resource, fields, marshal
  2.  
  3.  
  4. country_fields = {
  5. 'title': fields.String
  6. }
  7.  
  8.  
  9. class TravelCountryResource(Resource):
  10. def get(self):
  11. if request.content_type != 'application/json':
  12. return 'Cann\'t get travel countries in HTML format', 415
  13.  
  14. return {'result': marshal(list(Country.all()), country_fields)}, 200
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement