コード例 #1
0
    description=
    "This API provides endpoints such as Historical and Forecast in combination with and[or] without parameters"
)

weatherAPI = Namespace('HistoricalWeather', description='Historical Weather')
api.add_namespace(weatherAPI)

parser = reqparse.RequestParser()
parser.add_argument('DATE')
parser.add_argument('TMAX')
parser.add_argument('TMIN')

postModel = api.model(
    'AccountModel', {
        'DATE': fields.String(required=True,
                              description='Date in YYYYMMDD format'),
        'TMAX': fields.Integer(required=True, description='Max temp'),
        'TMIN': fields.Integer(required=True, description='Min temp'),
    })

args1 = {
    'DATE': fields.String(required=True,
                          description='Date in YYYYMMDD format'),
    'TMAX': fields.Integer(required=True, description='Max temp'),
    'TMIN': fields.Integer(required=True, description='Min temp')
}


class WeatherApplication(Resource):
    def get(self):
        return "/Historical/ , /Historical/'<DATE>' and /Forecast/'<DATE>' as GET Requests \n /Historical/ with date as POST and Delete Requests"
コード例 #2
0
ファイル: main.py プロジェクト: benaissaa/Test-Python-
account_fields = {
    'name': fields.String,
    'malls': fields.List(fields.Nested(mall_fields))
}

unit_fields = {
    'name': fields.String,
    
    'mall_id': fields.Integer
}


# __API Account__

account_definition = api.model('account Informations', {
    'name': fields.String(required=True)})


@api.route("/accounts")
class AccountListResource(Resource):
    def get(self):

        """
        returns a list of account with pagination
        """
        return pagination.paginate( Account,account_fields)

    @api.expect(account_definition)	
    def post(self):
        """
        Add a new account
コード例 #3
0
Customer_model = apii.model(
    'Customer', {
        '_id':
        fields.String(
            readOnly=True,
            description='The unique id assigned internally by service'),
        'first_name':
        fields.String(required=True,
                      description='The first name of a Customer'),
        'last_name':
        fields.String(required=True,
                      description='The last name of a Customer'),
        'address':
        fields.String(required=True, description='The address of a Customer'),
        'phone_number':
        fields.String(required=True,
                      description='The phone_number of a Customer'),
        'email':
        fields.String(required=True,
                      description='The last name of a Customer'),
        'username':
        fields.String(required=True,
                      description='The last username of a Customer'),
        'password':
        fields.String(required=True,
                      description='The last password of a Customer'),
        'active':
        fields.String(required=True,
                      description='The acive status of a Customer'),
        'id':
        fields.Integer(required=True, description='The ID of a Customer'),
    })