2016-07-24 15 views
1

エンドポイントに問題があります。私はローカルマシン上でGoogleのアプリケーションエンジンを使用しています。私は、エンドポイントAPIを作成しようとしています。 APIは正常に作成されますが、エクスプローラーを開いてAPIを選択すると、パラメータがいくつか与えられます。それは応答を返しません。Googleアプリケーションエンジンのエンドポイントapi python

api.py

import endpoints 
import protorpc 

from ModelClasses import test 


import main 

@endpoints.api(name="test",version="v1",description="testingapi",hostname="login-test-1208.appspot.com") 
class testapi(protorpc.remote.Service): 



    @test.method(name="userinsert",path="userinsert",http_method="POST") 
    def userinsert(self,request): 

     qr = test() 
     qr.user = request.user 
     qr.passw = request.passw 

     qr.put() 
     return qr 


app = endpoints.api_server([testapi],restricted=False) 

ModelClasses.py

from endpoints_proto_datastore.ndb import EndpointsModel 
from google.appengine.ext import ndb 



class test(EndpointsModel): 

    user = ndb.StringProperty(required=True) 
    passw = ndb.StringProperty(required=True) 

app.yamlを

application: ID 
version: 1 
runtime: python27 
api_version: 1 
threadsafe: yes 

handlers: 
- url: /favicon\.ico 
    static_files: favicon.ico 
    upload: favicon\.ico 


- url: /static 
    static_dir: static 

- url: /stylesheets 
    static_dir: stylesheets 

- url: /(.*\.js) 
    mime_type: text/javascript 
    static_files: static/\1 
    upload: static/(.*\.js) 


- url: /_ah/spi/.* 
    script: api.app 

libraries: 
- name: webapp2 
    version: latest 
- name: jinja2 
    version: latest 

- name: endpoints 
    version: latest 

- name: pycrypto 
    version: 1.0 

:応答では、ここ

見つかりません404はコードである前記しましたenter image description here

enter image description here

あなたは写真の中のリクエストとレスポンスを見ることができます。

ご協力いただければ幸いです。

+0

明確にするために、localhost上で実行されているAPIをテストしているか、既にAPIをApp Engineにデプロイしていますか? localhostで実行している場合は、オプションである 'hostname'パラメータを削除して、実際にリクエストがlocalhostに送信されるようにする必要があります。 – Scarygami

+0

私はlocalhost上で実行しているあなたの応答ありがとう。 –

+0

私はこれを試してみましょう。 –

答えて

1

@Scarygami回答が正しい。私はローカルホスト上で使用しているので、ホスト名を削除する必要があります。

+0

とにかくホスト名が必要なはずです。 – saiyr

関連する問題