Beispiel #1
0
    def post(self):
        data = ApiUrl.parser.parse_args()
        print('you are here')
        url = Url(data['login_url'], data['visit_url'])
        try:
            url.save_to_db()
        except:
            return {'message' : 'Failed to save'}, 500

        return url.json(), 201
Beispiel #2
0
 def put(self, id):
     data = ApiUrl.parser.parse_args()
     url = Url.find_by_id(id)
     if url is None:
         url = Url(data['login_url'], data['visit_url'])
     else:
         url.login_url = data['login_url']
         url.visit_url = data['visit_url']
     url.save_to_db()
     return url.json()
Beispiel #3
0
 def get(self):
     urls = Url.find_all(Url)
     return {'urls' : [Url.json(myInput) for myInput in urls]}