From c3a527c0dc64e06ac03efe664787ce0234f04b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@ericsson.com> Date: Fri, 5 Apr 2024 09:22:32 +0200 Subject: [PATCH] adapt for Flask 3.0.x, v0.3 --- .gitignore | 2 ++ LICENSE | 1 + Vagrantfile | 31 +++++++++++++++++++++++++++++++ flask_minijson.py | 7 ++++++- setup.cfg | 4 ++-- 5 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 Vagrantfile diff --git a/.gitignore b/.gitignore index b6e4761..ef1652e 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,8 @@ eggs/ lib/ lib64/ parts/ +.idea/ +.vagrant/ sdist/ var/ wheels/ diff --git a/LICENSE b/LICENSE index ae1214d..f71070c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ MIT License Copyright (c) 2021 Dronehub Group sp. z o. o. +Copyright (c) 2024 Piotr MaĹlanka Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..2d91c67 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,31 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + + config.vm.box = "debian/bullseye64" + + # Rabbit MQ management + config.vm.network "forwarded_port", guest: 15672, host: 15672, auto_correct: true + + # HTTP for viewing coverage reports + config.vm.network "forwarded_port", guest: 80, host: 8765 + + config.vm.provision "shell", inline: <<-SHELL + apt-get update + + # Python + apt-get install -y htop curl python3-pip build-essential python3 python3-setuptools + sudo pip3 install --upgrade pip setuptools + + # Install deps + sudo pip3 install -r /vagrant/requirements.txt + sudo pip3 install nose2[coverage_plugin] coverage mock yapf nose2 + + # .bashrc for default user + echo """# .bashrc + cd /vagrant""" > /home/vagrant/.bashrc + + SHELL + +end diff --git a/flask_minijson.py b/flask_minijson.py index cfefe8a..ea8ea4a 100644 --- a/flask_minijson.py +++ b/flask_minijson.py @@ -2,7 +2,12 @@ import typing as tp import minijson from flask import Flask -from flask_json import JsonRequest + +try: + from flask_json import JsonRequest +except ImportError: + # we must be running on a newer version of Flask-JSON + from flask_json import FlaskJSONRequest as JsonRequest class MiniJSONRequest(JsonRequest): diff --git a/setup.cfg b/setup.cfg index 841dfc2..8f03cf9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,13 +1,13 @@ # coding: utf-8 [metadata] -version = 0.2 +version = 0.3 name = flask-minijson long_description = file: README.md long_description_content_type = text/markdown; charset=UTF-8 author = Piotr MaĹlanka license_files = LICENSE -author_email = piotr.maslanka@dronehub.ai +author_email = pmaslanka@smok.co description = A Flask extension to allow client's to submit data using the MiniJSON codec url = https://github.com/Dronehub/flask-minijson project_urls = -- GitLab