Skip to main content

An API built on Flask-RESTful that returns with the names of all the states in USA.

Project description


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]( git repository.

$ git clone<your_git_username>/StatesofUSA.git

Now to run RESTapi server. Run the _main.py_ file

$ cd statesofusa/ $ python * Running on * 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 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”

Project details

Release history Release notifications

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for StatesofUSA, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size StatesofUSA-0.1-py2.7.egg (14.5 kB) File type Egg Python version 2.7 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page