Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
REST microservice framework based on Flask, OpenAPI, gunicorn and celery, deployable towards GKE and Beanstalk
Python microservice framework based on Flask, OpenAPI and Celery, deployable on GKE and Beanstalk
PyMacaron's documentation is available at http://pymacaron.com/.
This page dives deeper into internal implementation details.
The following endpoints are built-in into every pymacaron instance, based on this swagger specification:
# Assuming you did in a separate terminal:
# $ python server.py --port 8080
$ curl http://127.0.0.1:8080/ping
{}
$ curl http://127.0.0.1:8080/version
{
"apis":["ping"],
"name": "helloworld",
"pym_env":"staging",
"version": "220120-2219-3820-a6f45b",
}
$ curl http://127.0.0.1:8080/auth/version
{
"error_description": "There is no Authorization header in the HTTP request",
"error_id": "17f900c8-b456-4a64-8b2b-83c7d36353f6",
"status": 401,
"error": "AUTHORIZATION_HEADER_MISSING"
}
$ curl -H "Authorization: Bearer eyJpc3M[...]y8kNg" http://127.0.0.1:8080/auth/version
{
"apis":["ping"],
"name": "helloworld",
"pym_env":"staging",
"version": "220120-2219-3820-a6f45b",
}
It may come very handy within a standalone script to be able to call REST apis through the pymacaron framework, to get object marshalling and error handling out of the box. It is done as follows:
import flask
from pymacaron import apipool
from pymacaron.exceptions import is_error
# Declare a Flask app and mock its context
app = flask.Flask(__name__)
with app.test_request_context(''):
# Then load client libraries against a given set of libraries
api = API(app)
api.load_clients(apis=['login', 'search'])
# And you can now call those apis seamlessly!
result = ApiPool.login.client.do_login(
ApiPool.login.model.LoginData(
name='foobar',
password='youdontwanttoknow'
)
)
if is_error(result):
log.error("Oops. Failed to login user")
Erwan Lemonnier
github.com/pymacaron
github.com/erwan-lemonnier
www.linkedin.com/in/erwan-lemonnier/
FAQs
REST microservice framework based on Flask, OpenAPI, gunicorn and celery, deployable towards GKE and Beanstalk
We found that pymacaron demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.