3

I have the following code on my service and when requested the return is always 404.

@app.route('/v1/auth/service', methods=['POST'])
def verifyAuthService():
    data = request.get_json()

But in the log file, the service returns 404.

127.0.0.1 - - [TIMEVALUE] "POST /v1/auth/service HTTP/1.1" 404 -

But it works when I use other route. I have checked if the route path or method name are duplicated and didn't find anything.

I request the service method with the following code:

r = requests.post("http://myservice.com:5001/v1/auth/service", json=jPayload)
urb
  • 924
  • 1
  • 13
  • 28

2 Answers2

1

Maybe was a newbie error, in my init.py file, I haven't imported auth_services.py.

The /v1/auth/service route wasn't interpreted by python so, the route was inaccessible.

urb
  • 924
  • 1
  • 13
  • 28
  • See this question, it's helpful for debugging problems like this: http://stackoverflow.com/questions/13317536/get-a-list-of-all-routes-defined-in-the-app – nathancahill Oct 09 '15 at 16:09
0

Can you try building the URL with below code and match if the route is pointing to exactly same URL which you have called.

from flask import Flask, url_for

app = Flask(__name__)

@app.route('/v1/auth/service', methods=['POST'])
def verifyAuthService():
    data = request.get_json()

with app.test_request_context():
    print url_for('verifyAuthService')

Hope this helps!

Vinod
  • 549
  • 3
  • 8