Пример #1
0
 def insecure_core_server_with_auth(self, server_credentials):
     server = grpc.server(
         futures.ThreadPoolExecutor(max_workers=10),
         interceptors=(AllowAuthInterceptor(), ),
     )
     Core.add_CoreServiceServicer_to_server(CoreServicer(), server)
     server.add_insecure_port("[::]:50056")
     server.start()
     yield server
     server.stop(0)
Пример #2
0
 def secure_core_server_with_auth(self, server_credentials):
     server = grpc.server(
         futures.ThreadPoolExecutor(max_workers=10),
         interceptors=(AllowAuthInterceptor(), ),
     )
     Core.add_CoreServiceServicer_to_server(CoreServicer(), server)
     port = find_free_port()
     server.add_secure_port(f"[::]:{port}", server_credentials)
     server.start()
     yield port
     server.stop(0)