Пример #1
0
def update(id):
    print("Acces a /bucket/id avec POST")
    try:
        if request.headers['Content-Type'] != 'application/json':
            response = {
                "error": 1,
                "message": "Content-Type is not application/json"
            }
            return (response, 400)
        elif request.is_json:
            return BucketController.update(request)
        else:
            raise Exception()
    except Exception as e:
        print("ERROR: Request is not JSON or has missing fields.")
        response = {"error": 1, "message": "Missing fields in JSON"}
        print(response)
        return (response, 404)
Пример #2
0
def create():
    """
    POST => /buckets
    Recoit les informations pour enregistrer un nouveau bucket
    """
    print("Acces a /bucket avec POST")
    try:
        if request.headers['Content-Type'] != 'application/json':
            response = {
                "error": 1,
                "message": "Content-Type is not application/json"
            }
            return (response, 400)
        elif request.is_json:
            return BucketController.create(request)
        else:
            raise Exception()
    except Exception as e:
        print("ERROR: Request is not JSON or has missing fields.")
        print(e)
        response = {"error": 1, "message": "Missing fields in JSON"}
        return (response, 404)
Пример #3
0
def id(id):
    """
    GET => /buckets/id
    Renvoie un bucket spécifique.
    """
    return BucketController.get(id)
Пример #4
0
def index():
    """
    GET => /buckets
    Envoie la liste des buckets.
    """
    return BucketController.index()
Пример #5
0
def delete(id):
    """
    DELETE => /buckets/id
    Supprime un bucket
    """
    return BucketController.delete(id)
Пример #6
0
def id(id):
    return BucketController.get(id)
Пример #7
0
def index():
    return BucketController.index()
Пример #8
0
def delete(id):
    return BucketController.delete(id)