All Projects → tanmaybaranwal → grpc-django-book-service

tanmaybaranwal / grpc-django-book-service

Licence: other
gRPC implementation integrated with Django Application.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to grpc-django-book-service

ska
Sign data using symmetric-key algorithm encryption. Validate signed data and identify possible validation errors. Uses sha-(1, 224, 256, 385 and 512)/hmac for signature encryption. Custom hash algorithms are allowed. Useful shortcut functions for signing (and validating) dictionaries and URLs.
Stars: ✭ 39 (+39.29%)
Mutual labels:  django-rest-framework
BrewCenterAPI
An open source api for managing homebrewing related data.
Stars: ✭ 30 (+7.14%)
Mutual labels:  django-rest-framework
Bistu
集成了 django-simpleui 作为 admin 管理主题,实现的一个小型的管理系统,并且有的 django-rest-framework 使用示例。此外有个 Bistu-Ant-Design-Pro 项目作为配套的前端使用。如果喜欢记得给个🌟star哦。
Stars: ✭ 51 (+82.14%)
Mutual labels:  django-rest-framework
kubernetes-automation-toolkit
This repository contains code examples and documentation for learning how applications can be developed with Kubernetes
Stars: ✭ 51 (+82.14%)
Mutual labels:  django-rest-framework
pycamunda
Python REST api client for the workflow and decision automation engine Camunda.
Stars: ✭ 33 (+17.86%)
Mutual labels:  rest-client
My Dashboard
A dashboard powered by Django, showing a notepad, scraping news articles and finance data with dash.py
Stars: ✭ 54 (+92.86%)
Mutual labels:  django-rest-framework
camunda-client-go
Camunda REST API client for golang
Stars: ✭ 95 (+239.29%)
Mutual labels:  rest-client
drowsy
😪 Lazy integrations tool for RESTful interfaces to aid POC development and streamline integrations
Stars: ✭ 19 (-32.14%)
Mutual labels:  rest-client
django-rest-framework-files
File download and upload support for Django REST framework
Stars: ✭ 29 (+3.57%)
Mutual labels:  django-rest-framework
drf-addons
Some customised Django classes and functions that one can use in DJango. Collected from internet!
Stars: ✭ 20 (-28.57%)
Mutual labels:  django-rest-framework
vscode-f5
Let the F5 VSCode extension supercharge your workflows with schema validation, rest client, fast templates, and so much more!!!
Stars: ✭ 44 (+57.14%)
Mutual labels:  rest-client
recipeyak
🍛 Application to automate the selection of meals and creation of shopping lists.
Stars: ✭ 23 (-17.86%)
Mutual labels:  django-rest-framework
healthcare-server
A rubyOnRails based web application with a small concept behind healthcare
Stars: ✭ 16 (-42.86%)
Mutual labels:  rest-client
bowman
A Java library for accessing a JSON+HAL REST API
Stars: ✭ 45 (+60.71%)
Mutual labels:  rest-client
python-wechat-pay
Use Python3, Django, Django-rest-framework to achieve wechat payment. 微信支付、服务器异步通知、订单查询、退款
Stars: ✭ 18 (-35.71%)
Mutual labels:  django-rest-framework
django-rest-framework-recaptcha
reCAPTCHA field for Django REST framework serializers
Stars: ✭ 24 (-14.29%)
Mutual labels:  django-rest-framework
ecommerce api
E-commerce by Django Rest Framework
Stars: ✭ 156 (+457.14%)
Mutual labels:  django-rest-framework
YuiAPI
一个浏览器API测试客户端,API文档生成器,支持chrome/firefox/新版edge
Stars: ✭ 25 (-10.71%)
Mutual labels:  rest-client
django-mobile-app
A batteries-included mobile app backend in Django
Stars: ✭ 52 (+85.71%)
Mutual labels:  django-rest-framework
matchering-web
🎚️ Self-Hosted LANDR / eMastered Alternative
Stars: ✭ 25 (-10.71%)
Mutual labels:  django-rest-framework

gRPC + Django Integration with RESTart: gRPC Book Service

gRPC Integration with Django.

This project uses internal automation and build tools. The concerned files and folders in project are:

  • grpc_protos
  • grpc_utils
  • grpc_rest

The Django Application in this project is basic skeleton without serializers, urls and build files. It contains views and it's implementation which we will be using in grpc_services.

Setup virtualenv

pip install virtualenv
virtualenv .venv

Install requirements

$ pip install -r requirements.txt
$ pip install googleapis-common-protos
# if you ran into any issue with kerbrose package install below system dependencies
$ sudo apt-get install krb5-config libkrb5-dev libssl-dev libsasl2-dev libsasl2-modules-gssapi-mit

Running django management commands & usage

$ source .venv/bin/activate
$ export DJANGO_SETTINGS_MODULE=grpc_book_service_backend.settings.local

# Internal Tools
$ python manage.py build -a grpc_book_service # generate build files
$ python manage.py build -p grpc_book_service # generate protobuf

$ python manage.py makemigrations
$ python manage.py migrate

Running gRPC Server:

$ python manage.py generate_grpc_stubs grpc_book_service/grpc_protos app.proto

# If importing google.api.annotations:
$ python -m grpc_tools.protoc -I grpc_book_service/grpc_protos --python_out=./grpc_book_service/grpc_protos --grpc_python_out=./grpc_book_service/grpc_protos -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis grpc_book_service/grpc_protos/app.proto

# Start gRPC Server
$ python manage.py run_grpc_server grpc_book_service

Running REST Server with gRPC:

This is a way with golang http reverse proxy gateway mentioned at https://github.com/grpc-ecosystem/grpc-gateway

# GoLang Gateway out: 
$ protoc -I/usr/local/include -I. -I./grpc_book_service/grpc_protos -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --grpc-gateway_out=logtostderr=true:. ./grpc_book_service/grpc_protos/app.proto

Another way using https://github.com/RussellLuo/grpc-pytools/

# Generate AST File
$ python -m grpc_tools.protoc -I. --pytools-ast_out=grpc_book_service/grpc_rest/app_ast.json grpc_book_service/grpc_protos/app.proto

# Generate Pythonic Services based on Flask
$ python -m grpc_pytools.pythonic --proto-ast-file=grpc_book_service/grpc_protos/app_ast.json --pb2-module-name=grpc_book_service/grpc_protos/app_pb2 > grpc_book_service/grpc_rest/services.py

# Generate Marshmallow Schemas
$ python -m grpc_pytools.marshmallow --proto-ast-file=grpc_book_service/grpc_protos/app_ast.json --pb2-module-name=grpc_book_service/grpc_protos/app_pb2 > grpc_book_service/grpc_rest/schemas.py

# Generate RESTart APIs
$ python -m grpc_pytools.restart --proto-ast-file=grpc_book_service/grpc_protos/app_ast.json --pb2-module-name=grpc_book_service/grpc_protos/app_pb2 --grpc-server=localhost:50051 > grpc_book_service/grpc_rest/apis.py
# Modify the api path in <grpc_book_service/grpc_rest/apis.py> as per OpenAPI Spec

# Run the HTTP/1.1 server
$ restart grpc_book_service.grpc_rest.apis:api -p 60066

# Try cURL
$ curl -i -H 'Content-Type: application/json' -X POST http://localhost:60066/grpc_book_service/get_book_post -d '{"isbn": 1}'

Connecting to GRPC Using ServiceClient

from grpc_book_service.grpc_protos import app_pb2, app_pb2_grpc
from grpc_book_service.grpc_utils.service_client import ServiceClient
books_service_client = ServiceClient(app_pb2_grpc, 'GRPCBookServiceStub', 'localhost', 50051)
response = books_service_client.GetBookPost(app_pb2.GetBookRequest(isbn=1))

# <response:>
# isbn: 1
# name: "NW-Novel"
# author: "Hiroko Murakami"
# title: "Norwegian Wood"
# codes: 1.0
# codes: 2.5
# codes: 5.5

The project also has helper modules from following repos, packages and blogs:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].