8000 Update docs for 1.0 release · flask-api/flask-api@5be9eea · GitHub
[go: up one dir, main page]

Skip to content

Commit 5be9eea

Browse files
committed
Update docs for 1.0 release
1 parent 4221387 commit 5be9eea

File tree

5 files changed

+67
-112
lines changed

5 files changed

+67
-112
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ Requirements:
2222
* Python 2.7+ or 3.3+
2323
* Flask 0.10+
2424

25-
Install using `pip`.
25+
Install using `pip`:
2626

2727
pip install Flask-API
2828

29-
Import and initialize your application.
29+
Import and initialize your application:
3030

3131
from flask_api import FlaskAPI
3232

docs/about/release-notes.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Release Notes
22

3-
This project is currently in beta. It is functional and well tested but you are advised to pay close attention to the release notes when upgrading to future versions.
3+
## Version 1.0
4+
5+
* Stable release to enter maintenance mode.
46

57
## Version 0.7.1
68

docs/index.md

Lines changed: 60 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,10 @@ Browsable Web APIs for Flask
66

77
## Overview
88

9-
Flask API is an implementation of the same web browsable APIs that [Django REST framework][django-rest-framework] provides.
10-
11-
It gives you properly content negotiated responses and smart request parsing.
12-
13-
It is currently a work in progress, but the fundamentals are in place and you can already start building kick-ass browsable Web APIs with it. If you want to start using Flask API right now go ahead and do so, but be sure to follow the release notes of new versions carefully.
9+
Flask API is a drop-in replacement for Flask that provides an implementation of browsable APIs similar to what [Django REST framework](http://www.django-rest-framework.org) provides. It gives you properly content negotiated-responses and smart request parsing:
1410

1511
![Screenshot](screenshot.png)
1612

17-
## Roadmap
18-
19-
Future work on getting Flask API to a 1.0 release will include:
20-
21-
* Authentication, including session, basic and token authentication.
22-
* Permissions, including a simple user-is-authenticated permission.
23-
* Throttling, including a base rate throttling implementation.
24-
* Support for using class based views, including the base view class.
25-
* Browsable API improvements, such as breadcrumb generation.
26-
* Customizable exception handling.
27-
* CSRF protection for session authenticated requests.
28-
* Login and logout views for the browsable API.
29-
* Documentation on how to deal with request validation.
30-
* Documentation on how to deal with hyperlinking.
31-
32-
It is also possible that the core of Flask API could be refactored into an external dependency, in order to make browsable APIs easily available to any Python web framework.
33-
3413
## Installation
3514

3615
Requirements:
@@ -42,14 +21,13 @@ The following packages are optional:
4221

4322
* Markdown (2.1.0+) - Markdown support for the browsable API.
4423

45-
Install using `pip`, including any optional packages you want...
24+
Install using `pip`:
4625

4726
pip install Flask-API
48-
pip install markdown # Markdown support for the browsable API.
4927

50-
Import and initialize your application.
28+
Import and initialize your application:
5129

52-
from flask.ext.api import FlaskAPI
30+
from flask_api import FlaskAPI
5331

5432
app = FlaskAPI(__name__)
5533

@@ -75,62 +53,62 @@ Access the parsed request data using `request.data`. This will handle JSON or f
7553

7654
The following example demonstrates a simple API for creating, listing, updating and deleting notes.
7755

78-
from flask import request, url_for
79-
from flask.ext.api import FlaskAPI, status, exceptions
80-
81-
app = FlaskAPI(__name__)
82-
83-
84-
notes = {
85-
0: 'do the shopping',
86-
1: 'build the codez',
87-
2: 'paint the door',
88-
}
89-
90-
def note_repr(key):
91-
return {
92-
'url': request.host_url.rstrip('/') + url_for('notes_detail', key=key),
93-
'text': notes[key]
94-
}
95-
96-
97-
@app.route("/", methods=['GET', 'POST'])
98-
def notes_list():
99-
"""
100-
List or create notes.
101-
"""
102-
if request.method == 'POST':
103-
note = str(request.data.get('text', ''))
104-
idx = max(notes.keys()) + 1
105-
notes[idx] = note
106-
return note_repr(idx), status.HTTP_201_CREATED
107-
108-
# request.method == 'GET'
109-
return [note_repr(idx) for idx in sorted(notes.keys())]
110-
111-
112-
@app.route("/<int:key>/", methods=['GET', 'PUT', 'DELETE'])
113-
def notes_detail(key):
114-
"""
115-
Retrieve, update or delete note instances.
116-
"""
117-
if request.method == 'PUT':
118-
note = str(request.data.get('text', ''))
119-
notes[key] = note
120-
return note_repr(key)
121-
122-
elif request.method == 'DELETE':
123-
notes.pop(key, None)
124-
return '', status.HTTP_204_NO_CONTENT
125-
126-
# request.method == 'GET'
127-
if key not in notes:
128-
raise exceptions.NotFound()
129-
return note_repr(key)
130-
131-
132-
if __name__ == "__main__":
133-
app.run(debug=True)
56+
from flask import request, url_for
57+
from flask_api import FlaskAPI, status, exceptions
58+
59+
app = FlaskAPI(__name__)
60+
61+
62+
notes = {
63+
0: 'do the shopping',
64+
1: 'build the codez',
65+
2: 'paint the door',
66+
}
67+
68+
def note_repr(key):
69+
return {
70+
'url': request.host_url.rstrip('/') + url_for('notes_detail', key=key),
71+
'text': notes[key]
72+
}
73+
74+
75+
@app.route("/", methods=['GET', 'POST'])
76+
def notes_list():
77+
"""
78+
List or create notes.
79+
"""
80+
if request.method == 'POST':
81+
note = str(request.data.get('text', ''))
82+
idx = max(notes.keys()) + 1
83+
notes[idx] = note
84+
return note_repr(idx), status.HTTP_201_CREATED
85+
86+
# request.method == 'GET'
87+
return [note_repr(idx) for idx in sorted(notes.keys())]
88+
89+
90+
@app.route("/<int:key>/", methods=['GET', 'PUT', 'DELETE'])
91+
def notes_detail(key):
92+
"""
93+
Retrieve, update or delete note instances.
94+
"""
95+
if request.method == 'PUT':
96+
note = str(request.data.get('text', ''))
97+
notes[key] = note
98+
return note_repr(key)
99+
100+
elif request.method == 'DELETE':
101+
notes.pop(key, None)
102+
return '', status.HTTP_204_NO_CONTENT
103+
104+
# request.method == 'GET'
105+
if key not in notes:
106+
raise exceptions.NotFound()
107+
return note_repr(key)
108+
109+
110+
if __name__ == "__main__":
111+
app.run(debug=True)
134112

135113
Now run the webapp:
136114

@@ -148,17 +126,3 @@ You can now open a new tab and interact with the API from the command line:
148126
{"url": "http://127.0.0.1:5000/1/", "text": "flask api is teh awesomez"}
149127

150128
You can also work on the API directly in your browser, by opening <http://127.0.0.1:5000/>. You can then navigate between notes, and make `GET`, `PUT`, `POST` and `DELETE` API requests.
151-
152-
## Credits
153-
154-
To stay up to date with progress on Flask API, follow Tom Christie on twitter, [here][tomchristie].
155-
156-
Many thanks to [Nicolas Clairon][nicolas-clarion] for making the `flask_api` PyPI package available.
157-
158-
[travis-image]: https://travis-ci.org/tomchristie/flask-api.png?branch=master
159-
[travis-link]: https://travis-ci.org/tomchristie/flask-api
160-
[coveralls-image]: https://coveralls.io/repos/tomchristie/flask-api/badge.png?branch=master
161-
[coveralls-link]: https://coveralls.io/r/tomchristie/flask-api?branch=master
162-
[django-rest-framework]: http://www.django-rest-framework.org
163-
[tomchristie]: https://twitter.com/_tomchristie
164-
[nicolas-clarion]: https://github.com/namlook/

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__ = '0.7.1'
3+
__version__ = '1.0b1'

setup.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,6 @@ def get_package_data(package):
5454
for filename in filenames])
5555
return {package: filepaths}
5656

57-
58-
if sys.argv[-1] == 'publish':
59-
os.system("git clean -xdf")
60-
os.system("python setup.py sdist upload")
61-
args = {'version': get_version(package)}
62-
print("You probably want to also tag the version now:")
63-
print(" git tag -a %(version)s -m 'version %(version)s'" % args)
64-
print(" git push --tags")
65-
sys.exit()
66-
67-
6857
setup(
6958
name=name,
7059
version=get_version(package),
@@ -78,7 +67,7 @@ def get_package_data(package):
7867
package_data=get_package_data(package),
7968
install_requires=install_requires,
8069
classifiers=[
81-
'Development Status :: 4 - Beta',
70+
'Development Status :: 5 - Production/Stable',
8271
'Environment :: Web Environment',
8372
'Framework :: Flask',
8473
'Intended Audience :: Developers',

0 commit comments

Comments
 (0)
0