Django application for make sync requests (REST API) between microservices or external APIs.
If you don’t have any microservices yet, you can try to use Django template
Quickstart
Installation
Install the package
$ pip install django-microservice-request
Usage (Google Captcha example)
settings.py
GOOGLE_CAPTCHA_URL = "https://google.com/recaptcha/api/siteverify"
GOOGLE_CAPTCHA_SECRET_KEY = os.environ.get("GOOGLE_CAPTCHA_SECRET_KEY")
services.py
from django.conf import settings
from microservice_request.services import ConnectionService
class GoogleCaptchaService(ConnectionService):
service = settings.GOOGLE_CAPTCHA_URL
secret_key = settings.GOOGLE_CAPTCHA_SECRET_KEY
def validate_captcha(self, captcha: str) -> dict:
params = {
"secret": self.secret_key,
"response": captcha,
}
response = self.service_response(method="get", params=params)
return response.data
serializers.py
from .services import GoogleCaptchaService
class CaptchaMixinSerializer(serializers.Serializer):
captcha = serializers.CharField()
def validate_captcha(self, captcha: str) -> str:
service = GoogleCaptchaService()
response_data = service.validate_captcha(captcha)
if not response_data.get("success"):
raise serializers.ValidationError("Captcha validation error")
return captcha
class LoginSerializer(CaptchaMixinSerializer):
login = serializers.CharField()
password = serializers.CharField()
Metadata
Release files for django-microservice-request 0.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-microservice-request-0.5.3.tar.gz | 10.1 kB | Without provenance | Details for django-microservice-request-0.5.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_microservice_request-0.5.3-py3-none-any.whl | Python 3 | none | any | Details for django_microservice_request-0.5.3-py3-none-any.whl |
Total release size: 18.0 kB
Release files / django-microservice-request-0.5.3.tar.gz
| Download URL | django-microservice-request-0.5.3.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd755e8ac3168b2faf6a28c6c0898e6c8dcd7283038d9a0fb9e9465ea1f41eff
|
|
BLAKE2b-256 checksum How to use checksums |
388514ac08076f5cb4b3f8eaecf5c3085d41ad01e5b459f0c46bdd43ba63a2be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / django_microservice_request-0.5.3-py3-none-any.whl
| Download URL | django_microservice_request-0.5.3-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1354e0b306dcfc99531e3da218af9c8811259cb2ad152a6f1b41240e1541890
|
|
BLAKE2b-256 checksum How to use checksums |
84052df07c841ad74d2dccdcb68f87ae893fcaa8d474e26bb5b64d5f114047e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for django-microservice-request 0.5.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.