# main.py (inside of one microservice)
from ferris3 import endpoints
import endpoints as google_cloud_endpoints
from person_service import PersonService # this uses the F3 auto-service and auto-method annotations
# PersonService looks like:
# @auto_service(endpoint='person')
# class PersonService(Service):
#
# get = hvild.get(Person)
endpoints.add('backend-endpoint.yaml', default=True)
# backend-endpoint.yaml looks like:
# canonical_name: Backend API
# name: backend
# version: v1
# description: API for mobile apps
# auth_level: optional
# scopes:
# - USERINFO
# allowed_client_ids:
# - API_EXPLORER_CLIENT_ID
# - 11585xxxx03-lkadkljsdlkjdsfkjeer.apps.googleusercontent.com
# APIs
API_CLASSES = [PersonService]
app = google_cloud_endpoints.api_server(API_CLASSES)/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=test --unsafely-treat-insecure-origin-as-secure=http://localhost:60612
Any other thoughts about what i should check?
Not at the moment. If you can make an isolated case and share it with us we may be able to help further.
import ferris3
# Exposed as ferris.posts
@ferris3.auto_service
class PostsService(ferris3.Service):
...
# Exposed as ferris.photos
@ferris3.auto_service(name='photos')
class ImagesService(ferris3.Service):
...
# Exposed as mobile_only.photos
@ferris3.auto_service(name='photos', endpoint='mobile_only')
class ImagesApi(ferris3.Service):
...
canonical_name: Ferris Endpoint
# API name. Should be lower case and only contain letters, numbers and underscores.
# Used in the client libraries, e.g. gapi.client.ferris.
name: someEndpointName
You can now use this endpoint by name (the name field in the yaml file) when defining services.
@ferris3.auto_service(name='photos', endpoint='mobile_only')
@auto_service(name='someEndpointName')@auto_service(endpoint='someEndpointName', name='person')
@auto_service(resource_name='someEndpointName', name='person')
# Exposed as ferris.posts
@ferris3.auto_service
class PostsService(ferris3.Service):
- auto_service knows which endpoint this class is being attached to (ie presumably ferris in this case)
- the "posts" route-element gets added (I'm assuming by the directory structure but what if you're NOT using auto-discovery)
import vendor
vendor.add('lib')
# service_backend for full client API
module: backend
application: testproject
runtime: python27
threadsafe: true
api_version: 1
handlers:
# Endpoints handler
- url: /_ah/spi/.*
script: service_backend.main.app
# optional, always, never
secure: optional
# login: admin
libraries:
- name: pycrypto
version: latest
- name: endpoints
version: 1.0
import endpoints_config # establishes the endpoint 'backend' in registry w defaults (see below)import endpoints as google_cloud_endpointsimport ferris3 as f3
from person_service import PersonService # this loads endpoint classes (see below)backendEndpoint = f3.endpoints.get('backend')# service APIsAPI_CLASSES = [backendEndpoint]
# bind to the endpoint infrastructure & return the appapp = google_cloud_endpoints.api_server(API_CLASSES)
from ferris3 import endpointsendpoints.add('service_backend/backend-endpoint.yaml', default=True)
# some boilerplate imports up here
import ferris3 as f3from common.models.person_model import Person
# experimenting: next 2 lines may be unnecessary with Ferris3
# with straight google endpoints I would need one of these as my decorators for classes belowendpoint = f3.endpoints.default()backendEndpoint = f3.endpoints.get('backend')# some message structures declared here@auto_service(endpoint='backend', resource_name='person')class PersonService(Service):get = hvild.get(Person)
dev_appserver.py service_backend.yaml
INFO 2016-02-28 14:56:53,316 sdk_update_checker.py:229] Checking for updates to the SDK.
INFO 2016-02-28 14:56:53,567 api_server.py:205] Starting API server at: http://localhost:55078
INFO 2016-02-28 14:56:53,571 dispatcher.py:197] Starting module "backend" running at: http://localhost:8080
INFO 2016-02-28 14:56:53,573 admin_server.py:116] Starting admin server at: http://localhost:8000
WARNING 2016-02-28 14:56:53,573 devappserver2.py:835] No default module found. Ignoring.
INFO 2016-02-28 14:57:12,811 module.py:787] backend: "GET /_ah/api/explorer HTTP/1.1" 302