Skip to content

mdragoss/microclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

microclient

Microservice HTTP Client

Microservice HTTP Client Base

BaseClient is a reusable, extensible base class for creating HTTP clients in a microservices architecture. It simplifies making requests to internal services and includes built-in retry logic, error handling, and token-based authentication.

Features

  • Retry with exponential backoff and jitter
  • Easy Bearer token injection
  • Centralized error handling (ServiceError)
  • Custom retry hook for logging/monitoring
  • Designed for subclassing per microservice

Example

from microclient.cline.base import BaseClient

class InventoryClient(BaseClient):
    def get_stock(self, product_id):
        return self._request("GET", f"/inventory/{product_id}")

class OrderClient(BaseClient):
    def create_order(self, order_data):
        return self._request("POST", "/orders", json=order_data)

About

Microservice HTTP Client Base

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages