3

I am essentially trying to create two endpoints, one where time is passed and if the time isnt passed it takes on a default value. It works completely fine when I use the request url, I get the output I require. However, the swagger UI still shows time as a required parameter for the first endpoint, due to which I am not able to use the UI to generate the json without inputting a time.

Below is a brief illustration of what I am trying to do:

@api.route("<string:username">/, defaults={'time': 1000})
@api.route("<string:username><string:time>/")
class Test(Resource):
    def get(self, username, time):
        ...

I understand this is due to the get method having both the params, any workarounds to this?

Aman Agarwal
  • 31
  • 1
  • 6

0 Answers0