def get_user_pw(request):
    """
    Obtains user's credentials from request object.
    @return (username, password) if credentials are available
    and (None, None) otherwise
    """
    if 'Authorization' not in request.headers:
        return (None, None)
    auth = request.authorization
    return (auth.username, auth.password)