How to call url for wsgi python application

Viewed 23

genius wsgi developers. I have wsgi python project that I am trying to run urls via postman or console but its giving me "Not found". I strongly think I am not calling it in a right way. Can someone please look into my code given below and see how should I call it. Thanks in advance.

api.py

import pkgutil

from backend import wsgi


class Application(wsgi.Application):
    pass


application = Application(base_path="api")
service = application.service
endpoint = application.service


for _, modname, _ in pkgutil.walk_packages(path=pkgutil.extend_path(__path__, __name__), prefix=__name__ + "."):
    __import__(modname)

user.py

class CreateRequest(messages.Message):
    email = messages.StringField(1, required=True)
    password = messages.StringField(2, required=True)
    name = messages.StringField(3)


class TokenRequest(messages.Message):
    access_token = messages.StringField(1, required=True)
    refresh_token = messages.StringField(2, required=True)

@api.endpoint(path="user", title="User API")
class User(remote.Service):
    @swagger("Create a user")
    @remote.method(CreateRequest, TokenResponse)
    def create(self, request):
        u = user.User.create(email=request.email, password=request.password, name=request.name)
        session = Oauth2.create(u.key)

        return TokenResponse(
            access_token=session.access_token.token,
            expires=time.mktime(session.access_token.expires.timetuple()),
            refresh_token=session.refresh_token.token,
        )

can someone guide me how should I call create user in postman or console.

I am trying postmen calling

0 Answers
Related