8000 Merge pull request #132 from flask-api/release/v3.0 · flask-api/flask-api@397989f · GitHub
[go: up one dir, main page]

Skip to content

Commit 397989f

Browse files
authored
Merge pull request #132 from flask-api/release/v3.0
Release v3.0
2 parents beb2aa4 + 57f2a0f commit 397989f

15 files changed

+259
-109
lines changed

Pipfile.lock

Lines changed: 238 additions & 86 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Browsable web APIs for Flask.
44

5-
[![Unix Build Status](https://img.shields.io/travis/flask-api/flask-api.svg)](https://travis-ci.org/flask-api/flask-api)
5+
[![Unix Build Status](https://img.shields.io/travis/com/flask-api/flask-api.svg)](https://travis-ci.com/flask-api/flask-api)
66
[![Coverage Status](https://img.shields.io/coveralls/flask-api/flask-api.svg)](https://coveralls.io/r/flask-api/flask-api)
77
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/flask-api/flask-api.svg)](https://scrutinizer-ci.com/g/flask-api/flask-api/)
88
[![PyPI Version](https://img.shields.io/pypi/v/Flask-API.svg)](https://pypi.org/project/Flask-API/)

docs/CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/about/release-notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes
22

3+
## Version 3.0
4+
5+
* Dropped support for Flask `<2.0`.
6+
37
## Version 2.0
48

59
* Dropped support for Python `<3.6`.

docs/screenshot.png

11.8 KB
Loading

flask_api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from flask_api.app import FlaskAPI
22

3-
__version__ = '2.0'
3+
__version__ = '3.0'

flask_api/app.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# coding: utf8
22
from __future__ import unicode_literals
33
from flask import request, Flask, Blueprint
4-
from flask._compat import reraise, string_types, text_type
54
from flask_api.exceptions import APIException
65
from flask_api.request import APIRequest
76
from flask_api.response import APIResponse
@@ -59,15 +58,15 @@ def make_response(self, rv):
5958
headers, status_or_headers = status_or_headers, None
6059

6160
if not isinstance(rv, self.response_class):
62-
if isinstance(rv, (text_type, bytes, bytearray, list, dict)):
61+
if isinstance(rv, (str, bytes, bytearray, list, dict)):
6362
status = status_or_headers
6463
rv = self.response_class(rv, headers=headers, status=status)
6564
headers = status_or_headers = None
6665
else:
6766
rv = self.response_class.force_type(rv, request.environ)
6867

6968
if status_or_headers is not None:
70-
if isinstance(status_or_headers, string_types):
69+
if isinstance(status_or_headers, str):
7170
rv.status = status_or_headers
7271
else:
7372
rv.status_code = status_or_headers
@@ -104,7 +103,7 @@ def handle_user_exception(self, e):
104103
if isinstance(e, typecheck):
105104
return handler(e)
106105

107-
reraise(exc_type, exc_value, tb)
106+
raise e
108107

109108
def handle_api_exception(self, exc):
110109
content = {'message': exc.detail}

flask_api/parsers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# coding: utf8
22
from __future__ import unicode_literals
3-
from flask._compat import text_type
43
from flask_api import exceptions
54
from werkzeug.formparser import MultiPartParser as WerkzeugMultiPartParser
65
from werkzeug.formparser import default_stream_factory
@@ -26,7 +25,7 @@ def parse(self, stream, media_type, **options):
2625
try:
2726
return json.loads(data)
2827
except ValueError as exc:
29-
msg = 'JSON parse error - %s' % text_type(exc)
28+
msg = 'JSON parse error - %s' % str(exc)
3029
raise exceptions.ParseError(msg)
3130

3231

@@ -53,7 +52,7 @@ def parse(self, stream, media_type, **options):
5352
try:
5453
return multipart_parser.parse(stream, boundary, content_length)
5554
except ValueError as exc:
56-
msg = 'Multipart parse error - %s' % text_type(exc)
55+
msg = 'Multipart parse error - %s' % str(exc)
5756
raise exceptions.ParseError(msg)
5857

5958

flask_api/request.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from werkzeug.datastructures import MultiDict
77
from werkzeug.urls import url_decode_stream
88
from werkzeug.wsgi import get_content_length
9-
from werkzeug._compat import to_unicode
109
import io
1110

1211

@@ -38,7 +37,7 @@ def files(self):
3837

3938
def _parse(self):
4039
"""
41-
Parse the body of the request, using whichever parser satifies the
40+
Parse the body of the request, using whichever parser satisfies the
4241
client 'Content-Type' header.
4342
"""
4443
if not self.content_type or not self.content_length:
@@ -169,7 +168,7 @@ def full_path(self):
169168
"""
170169
if not self.query_string:
171170
return self.path
172-
return self.path + u'?' + to_unicode(self.query_string, self.url_charset)
171+
return self.path + '?' + self.query_string.decode()
173172

174173
# @property
175174
# def auth(self):

flask_api/response.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# coding: utf8
22
from __future__ import unicode_literals
33
from flask import request, Response
4-
from flask._compat import text_type
54

65

76
class APIResponse(Response):
@@ -24,7 +23,7 @@ def __init__(self, content=None, *args, **kwargs):
2423
# From `werkzeug.wrappers.BaseResponse`
2524
if content is None:
2625
content = []
27-
if isinstance(content, (text_type, bytes, bytearray)):
26+
if isinstance(content, (str, bytes, bytearray)):
2827
self.set_data(content)
2928
else:
3029
self.response = content

flask_api/settings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from flask._compat import string_types
21
import importlib
32

43

@@ -7,7 +6,7 @@ def perform_imports(val, setting_name):
76
If the given setting is a string import notation,
87
then perform the necessary import or imports.
98
"""
10-
if isinstance(val, string_types):
9+
if isinstance(val, str):
1110
return import_from_string(val, setting_name)
1211
elif isinstance(val, (list, tuple)):
1312
return [perform_imports(item, setting_name) for item in val]

flask_api/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<div class="navbar-inner">
3232
<div class="container-fluid">
3333
<span href="/">
34-
{% block branding %}<a class='brand' rel="nofollow" href='http://www.flaskapi.org'>Flask API <span class="version">{{ version }}</span></a>{% endblock %}
34+
{% block branding %}<a class='brand' rel="nofollow" href='https://flask-api.github.io/flask-api/'>Flask API <span class="version">{{ version }}</span></a>{% endblock %}
3535
</span>
3636
<ul class="nav pull-right">
3737
{% block userlinks %}

flask_api/tests/test_parsers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ def test_invalid_json(self):
3636
with self.assertRaises(exceptions.ParseError) as context:
3737
parser.parse(stream, mediatypes.MediaType('application/json'))
3838
detail = str(context.exception)
39-
expected_py2 = 'JSON parse error - Expecting property name: line 1 column 1 (char 1)'
< 7802 /td>39+
expected_pypy = 'JSON parse error - Key name must be string at char: line 1 column 2 (char 1)'
4040
expected_py3 = 'JSON parse error - Expecting property name enclosed in double quotes: line 1 column 2 (char 1)'
41-
self.assertIn(detail, (expected_py2, expected_py3))
41+
self.assertIn(detail, (expected_pypy, expected_py3))
4242

4343
def test_invalid_multipart(self):
4444
parser = parsers.MultiPartParser()

mkdocs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ pages:
1414

1515
repo_url: https://github.com/flask-api/flask-api
1616
copyright: '<a href="/about/license">BSD licensed</a> <b>&middot;</b> Copyright &copy; 2017, <a href="https://twitter.com/_tomchristie">Tom Christie</a>.'
17-
google_analytics: ['UA-27795084-4', 'flaskapi.org']

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
name = 'Flask-API'
1212
package = 'flask_api'
1313
description = 'Browsable web APIs for Flask.'
14-
url = 'http://www.flaskapi.org'
14+
url = 'https://flask-api.github.io/flask-api/'
1515
author = 'Tom Christie'
1616
author_email = 'tom@tomchristie.com'
1717
license = 'BSD'
18-
install_requires = ['Flask >= 1.1']
18+
install_requires = ['Flask >= 2.0']
1919

2020
long_description = """Browsable web APIs for Flask."""
2121

@@ -77,6 +77,7 @@ def get_package_data(package):
7777
'Programming Language :: Python :: 3.6',
7878
'Programming Language :: Python :: 3.7',
7979
'Programming Language :: Python :: 3.8',
80+
'Programming Language :: Python :: 3.9',
8081
'Topic :: Internet :: WWW/HTTP',
8182
]
8283
)

0 commit comments

Comments
 (0)
0