GithubHelp home page GithubHelp logo

micro-client's Introduction

mico-client

Python 3 resolver for go-micro grpc services.

Build Status

Examples

Compiling

Make sure you have the needed protobuf and plugins.

Notes:

  • You will need to set or replace the variables!
  • Make sure you have the python package grpcio-tools installed!
    PATH=$PATH:$GOBIN_PATH protoc -I=$SOURCE_OF_MICRO_PROJECT --proto_path=$GOPATH/src:. --python_out=plugins=micro,grpc:. $PATH_TO_PROTO_FILE
    python -m grpc_tools.protoc -I=$SOURCE_OF_MICRO_PROJECT --python_out=. --grpc_python_out=. $PATH_TO_PROTO_FILE

Etcd

    from micro_client.registry.etcdregistry import etcd, Registry
    from micro_client.common import Services

    s = Services(Registry(etcd.Client(port=2379), '/micro-registry'))

Consul

    import requests

    from micro_client.registry.consulregistry import Registry
    from micro_client.common import Services

    s = Services('http://127.0.0.1:8500/v1', session=requests.Session()))

Use it!

    service = s.resolve('some')
    print(service.connection_info)

    # Import the stub and grpc structures for use
    import grpc
    from some_pb2_grpc import SomeStub
    from some_pb2 import Input, Structures
    
    # Get the stub
    stub = services.insecure('some', SomeStub)
    # Call it
    result = stub.SomeCall(Input(Data=1), Structures(Some="data", ID=1))

micro-client's People

Contributors

ashcrow avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pkujohnson

micro-client's Issues

How to build a micro service using python

hi, I have build a group of microservice based on go-micro using golang. as some libs was build with python, I want to write some microservice in python under the framework of go-micro. Can you give me some advice? thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.