An API built on Flask-RESTful that returns with the names of all the states in USA.
Project description
##StatesofUSA##
A REST API to return names of the states of U.S.A. This API is built on Flask-restful.
Follow the steps below to create a REST app on your Linux machine.
Make sure you have installed python-pip First create a virtial environment using pip.
$ sudo apt-get install python-virtualenv
Create an evironment of your own. Use a separate folder where you want to have the virtual setup. Here I’m creating a folder _statesofusa_env_ then a _venv_ within.
$ mkdir statesofusa_env $ cd statesofusa_env $ virtualenv venv
New python executable in venv/bin/python Installing distribute…………done.
Now enter the virtual environment
$ . venv/bin/activate
Once this is done, you will be inside the virtual mode. (notice the prompt shows a venv environment) Now install Flask and Flask-restful
$ pip install Flask $ pip install flask-restful
Once you have done that. All your requirements are ready. You now have to get the [StatesofUSA](https://github.com/ishammi/StatesofUSA/) git repository.
$ git clone git@github.com:<your_git_username>/StatesofUSA.git
Now to run RESTapi server. Run the _main.py_ file
$ cd statesofusa/ $ python main.py * Running on http://127.0.0.1:5000/ * Restarting with reloader
Congratulations.. Your Flask REST server is up and running in the local machine on port 5000. However the API is routed to the URL http://127.0.0.1:5000/states/ For convinience, we have hard coded few authorization parameters. Use the token ‘38c50d14-436b-4e3e-b447-e2e9334fea1a’ to hit the API from outside the virtual environment. Here’s an example
$ curl -H “Authorization: token 38c50d14-436b-4e3e-b447-e2e9334fea1a” –data “page=1&items_per_page=10” http://127.0.0.1:5000/states/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file StatesofUSA-0.1-py2.7.egg.
File metadata
- Download URL: StatesofUSA-0.1-py2.7.egg
- Upload date:
- Size: 14.5 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d194b3388775a30e808e8fe222f3066b7d4ca9a63d7575ba6582c88aedbedf6e
|
|
| MD5 |
001489ef673b93398a98d7bbe00d5166
|
|
| BLAKE2b-256 |
5052a810367b9e75b4a4333cee1beaf3e7d336226af268bd68c4e1b504c31a02
|