def main():
    password_manager = PasswordManager(".raspirestpass")
    username = input("Enter the username: "******"Enter the password: "******"utf-8"))
    password_manager.write()
""" This script contains the implementation of the REST api on the
    raspberry-pi.

    Author: Julien Delplanque
"""
import subprocess
from flask import Flask, jsonify, Response
from flask.ext.httpauth import HTTPBasicAuth
import sensors
import pkgmanagers
import systeminfo
from passwordmanagement import PasswordManager

app = Flask(__name__)
auth = HTTPBasicAuth()
password_manager = PasswordManager(".raspirestpass")

@auth.verify_password
def verify_password(username, password):
    return password_manager.is_correct(username, password)

@auth.error_handler
def unauthorized():
    return Response("You are not authorized to access this resource.", 401)

@app.route('/pkgtoupdate', methods = ['GET'])
@auth.login_required
def pkg_to_update():
    """ Return a json object containing the packages to update.
    """
    dic = {}