
import json
import ConfigParser

import falcon


class _SimpleResource(object):
    def __init__(self, conf):
        try:
            message = conf.get('sample_app', 'message')
        except ConfigParser.Error:
            message = 'something'
        self._message = message

    def on_get(self, req, resp):
        resp.body = json.dumps({'message': self._message})
        resp.set_header('Content-Type', 'application/json')

    def on_put(self, req, resp):
        doc = json.load(req.stream)
        self._message = doc['message']
        resp.body = json.dumps({'message': self._message})


def make_application():
    conf = ConfigParser.RawConfigParser()
    conf.read(['/etc/sample_app/sample_app.conf'])

    application = falcon.API()
    application.add_route('/', _SimpleResource(conf))

    return application


import ConfigParser
import json

import falcon


class _SimpleResource(object):
    def __init__(self, conf):
        try:
            message = conf.get('sample_app', 'message')
        except ConfigParser.Error:
            message = 'something'
        self._message = message

    def on_get(self, req, resp):
        resp.body = json.dumps({'message': self._message})
        resp.set_header('Content-Type', 'application/json')

    def on_put(self, req, resp):
        doc = json.load(req.stream)
        self._message = doc['message']
        resp.body = json.dumps({'message': self._message})


def make_application():
    conf = ConfigParser.RawConfigParser()
    conf.read(['/etc/sample_app/sample_app.conf'])

    application = falcon.API()
    application.add_route('/', _SimpleResource(conf))

    return application

Fix pep8 order import issue
Fix pep8 order import issue

  
+ import ConfigParser
  import json
- import ConfigParser
  
  import falcon
  
  
  class _SimpleResource(object):
      def __init__(self, conf):
          try:
              message = conf.get('sample_app', 'message')
          except ConfigParser.Error:
              message = 'something'
          self._message = message
  
      def on_get(self, req, resp):
          resp.body = json.dumps({'message': self._message})
          resp.set_header('Content-Type', 'application/json')
  
      def on_put(self, req, resp):
          doc = json.load(req.stream)
          self._message = doc['message']
          resp.body = json.dumps({'message': self._message})
  
  
  def make_application():
      conf = ConfigParser.RawConfigParser()
      conf.read(['/etc/sample_app/sample_app.conf'])
  
      application = falcon.API()
      application.add_route('/', _SimpleResource(conf))
  
      return application
  
Fix pep8 order import issue
## Code Before:

import json
import ConfigParser

import falcon


class _SimpleResource(object):
    def __init__(self, conf):
        try:
            message = conf.get('sample_app', 'message')
        except ConfigParser.Error:
            message = 'something'
        self._message = message

    def on_get(self, req, resp):
        resp.body = json.dumps({'message': self._message})
        resp.set_header('Content-Type', 'application/json')

    def on_put(self, req, resp):
        doc = json.load(req.stream)
        self._message = doc['message']
        resp.body = json.dumps({'message': self._message})


def make_application():
    conf = ConfigParser.RawConfigParser()
    conf.read(['/etc/sample_app/sample_app.conf'])

    application = falcon.API()
    application.add_route('/', _SimpleResource(conf))

    return application

## Instruction:
Fix pep8 order import issue
## Code After:

import ConfigParser
import json

import falcon


class _SimpleResource(object):
    def __init__(self, conf):
        try:
            message = conf.get('sample_app', 'message')
        except ConfigParser.Error:
            message = 'something'
        self._message = message

    def on_get(self, req, resp):
        resp.body = json.dumps({'message': self._message})
        resp.set_header('Content-Type', 'application/json')

    def on_put(self, req, resp):
        doc = json.load(req.stream)
        self._message = doc['message']
        resp.body = json.dumps({'message': self._message})


def make_application():
    conf = ConfigParser.RawConfigParser()
    conf.read(['/etc/sample_app/sample_app.conf'])

    application = falcon.API()
    application.add_route('/', _SimpleResource(conf))

    return application
