Я работаю с oauth2.Я написал три класса моделей в одном файле.
from datetime import datetime, timedelta
import time
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import Column, String, Boolean, Text, Integer
from authlib.flask.oauth2.sqla import (
OAuth2ClientMixin,
OAuth2AuthorizationCodeMixin,
OAuth2TokenMixin,
)
db = SQLAlchemy()
class OAuth2Client(db.Model, OAuth2ClientMixin):
__tablename__ = "oauth2_client"
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(
db.Integer, db.ForeignKey("user.id", ondelete="CASCADE"))
user = db.relationship("User")
client_token = Column(String(255), unique=True, nullable=False)
class OAuth2AuthorizationCode(db.Model, OAuth2AuthorizationCodeMixin):
__tablename__ = "oauth2_code"
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(
db.Integer, db.ForeignKey("user.id", ondelete="CASCADE"))
user = db.relationship('User')
class OAuth2Token(db.Model, OAuth2TokenMixin):
"""
"""
__tablename__ = "oauth2_token"
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(
db.Integer, db.ForeignKey("user.id", ondelete="CASCADE"))
user = db.relationship("User")
access_token = Column(String(255), unique=True, nullable=False)
refresh_token = Column(String(255), index=True)
expires_in = Column(Integer, nullable=False, default=0)
scope = Column(Text, default="")
@property
def set_token(self, client_token):
"""
:param client_token:
:return:
"""
self.access_token = client_token
self.refresh_token = client_token
@property
def set_expires(self, client_expires_in):
"""
:param client_expires_in:
:return:
"""
self.expires_in = client_expires_in
@property
def set_scope(self, client_scope):
"""
:param client_scope:
:return:
"""
self.scope = client_scope
def is_refresh_token_expired(self):
"""
:return:
"""
expires_at = self.issued_at + self.expires_in * 2
return expires_at < time.time()
class User(db.Model):
"""
"""
__tablename__ = "user"
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(40), unique=True)
user_id = db.Column(db.Integer)
client_id = db.Column(db.Integer)
user_ssh_id = db.Column(
db.String(40),
nullable=True,
)
# currently only bearer is supported
scope = db.Column(db.String(40))
shh_key_location = db.Column(db.String(40))
token = db.Column(db.String(255), unique=True)
expires = db.Column(db.Integer)
_scopes = db.Column(db.Text)
def __str__(self):
"""
:return:
"""
return self.username
def get_user_id(self):
"""
:return:
"""
return self.id
def check_password(self, password):
"""
:param password:
:return:
"""
return password == "valid"
И в другом файле, который у меня есть, который создает экземпляры объектов и вставляет их в базу данных
# coding: utf-8
"""
https://github.com/authlib/example-oauth2-server/tree/master/website
"""
import requests
import json
import pickle
from flask import request, session, render_template
from authlib.oauth2 import OAuth2Error
from authlib.oauth2.rfc6750 import BearerTokenValidator
from authlib.flask.oauth2 import AuthorizationServer, ResourceProtector
from authlib.flask.oauth2.sqla import (
create_query_client_func,
create_save_token_func,
create_revocation_endpoint,
create_bearer_token_validator,
)
from authlib.oauth2.rfc6749 import grants
from werkzeug.security import gen_salt
from ..admin import auth as Oauth2
from ..admin.auth import db as oauth_db
token_endpoints = {}
auth_endpoints = {}
client_endpoints = {}
token_endpoints['dev_token_url'] = 'https://someserver/token'
def get_token(query_client=None):
"""
:param query_client:
:return:
"""
headers = {
'Content-Type': 'application/json',
'Cache-Control': 'no-store',
'Pragma': 'no-cache',
}
url = token_endpoints['dev_token_url']
if query_client:
form = {
"client_id": query_client['client_id'],
"client_secret": query_client['client_secret'],
"grant_type": query_client['grant_type'],
"SCOPE": query_client['scope'],
}
response = requests.post(url, data=form)
#ToDo: FWJ implement logger print(response.text)
json_response = json.loads(response.text)
try:
token = Oauth2.OAuth2Token()
token.user_id = query_client['client_id']
token.scope = query_client['scope']
token.expires_in = json_response['expires_in']
token.refresh_token = json_response['access_token']
token.access_token = json_response['access_token']
user = get_user(query_client, json_response)
client = get_client(query_client, user, json_response['access_token'])
oauth_db.session.add(token, user)
oauth_db.session.add(user)
oauth_db.session.add(client, user)
oauth_db.session.commit()
except Exception as e:
return headers, e, 405
return headers, json_response, 200
def get_user(query_data, json_data):
"""
:param query_data:
:param json_data:
:return:
"""
token_user = Oauth2.User()
token_user.user_id = query_data['client_id']
token_user.client_id = query_data['client_id']
token_user.scope = query_data['scope']
token_user.expires = json_data['expires_in']
token_user.token = json_data['access_token']
return token_user
def get_client(query_client, client_user, client_user_token):
"""
:param query_client:
:param access_token:
:return:
"""
client = Oauth2.OAuth2Client()
client.client_id = query_client['client_id']
client.user = client_user
client.client_token = client_user_token
return client
class AuthorizationCodeGrant(grants.AuthorizationCodeGrant):
"""
"""
def create_authorization_code(self, client, user, request):
"""
:param client:
:param user:
:param request:
:return:
"""
code = gen_salt(48)
item = Oauth2.OAuth2AuthorizationCode(
code=code,
client_id=client.client_id,
redirect_uri=request.redirect_uri,
scope=request.scope,
user_id=user.id,
)
oauth_db.session.add(item)
oauth_db.session.commit()
return code
def parse_authorization_code(self, code, client):
"""
:param code:
:param client:
:return:
"""
item = Oauth2.OAuth2AuthorizationCode.query.filter_by(
code=code, client_id=client.client_id).first()
if item and not item.is_expired():
return item
def delete_authorization_code(self, authorization_code):
"""
:param authorization_code:
:return:
"""
self.session.delete(authorization_code)
self.session.commit()
def authenticate_user(self, authorization_code):
"""
:param authorization_code:
:return:
"""
return Oauth2.User.query.get(authorization_code.user_id)
class PasswordGrant(grants.ResourceOwnerPasswordCredentialsGrant):
"""
"""
def authenticate_user(self, username, password):
"""
:param username:
:param password:
:return:
"""
user = Oauth2.User.query.filter_by(username=username).first()
if user.check_password(password):
return user
class RefreshTokenGrant(grants.RefreshTokenGrant):
"""
"""
def authenticate_refresh_token(self, refresh_token):
"""
:param refresh_token:
:return:
"""
Oauth2.OAuth2Token.query.filter_by()
item = Oauth2.OAuth2Token.query.filter_by(refresh_token=refresh_token).first()
if item and not item.is_refresh_token_expired():
return item
def authenticate_user(self, credential):
"""
:param credential:
:return:
"""
return Oauth2.User.User.query.get(credential.user_id)
class AuthTokenValidator(BearerTokenValidator):
"""
"""
def authenticate_token(self, token_string):
"""
:param token_string:
:return:
"""
user_auth_token = None
client_auth_token = None
auth_token = oauth_db.session.query(Oauth2.OAuth2Token).filter(Oauth2.OAuth2Token.access_token==token_string).first()
if auth_token is not None:
return auth_token
if auth_token is None:
user_auth_token = oauth_db.session.query(Oauth2.User).filter(Oauth2.User.token==token_string).first()
return user_auth_token
if user_auth_token is None:
client_auth_token = oauth_db.session.query(Oauth2.OAuth2Client).filter(Oauth2.OAuth2Client.client_token==token_string).first()
return client_auth_token
def request_invalid(self, request):
"""
:param request:
:return:
"""
return False
def token_revoked(self, token):
"""
:param token:
:return:
"""
return False
query_client = create_query_client_func(oauth_db.session, Oauth2.OAuth2Client)
save_token = create_save_token_func(oauth_db.session, Oauth2.OAuth2Token)
authorization = AuthorizationServer(
query_client=query_client,
save_token=save_token,
)
require_oauth = ResourceProtector()
# require_oauth.register_token_validator(AuthTokenValidator())
# helper function: create_bearer_token_validator
# bearer_cls = create_bearer_token_validator(oauth_db.session, Oauth2.OAuth2Token)
# require_oauth.register_token_validator(bearer_cls())
# authorization = get_token()
def config_oauth(app):
"""
:param app:
:return:
"""
#authorization.init_app(app)
# support all grants
authorization.register_grant(grants.ImplicitGrant)
authorization.register_grant(grants.ClientCredentialsGrant)
authorization.register_grant(AuthorizationCodeGrant)
authorization.register_grant(PasswordGrant)
authorization.register_grant(RefreshTokenGrant)
# support revocation
revocation_cls = create_revocation_endpoint(oauth_db.session, Oauth2.OAuth2Token)
authorization.register_endpoint(revocation_cls)
# protect resource
# bearer_cls = create_bearer_token_validator(oauth_db.session, Oauth2.OAuth2Token)
require_oauth.register_token_validator(AuthTokenValidator()) # bearer_cls())
app.config.update({'SQLALCHEMY_TRACK_MODIFICATIONS': False})
oauth_db.init_app(app)
oauth_db.app = app
# Base.metadata.create_all(engine)
oauth_db.create_all()
return app
Я декорирую HTTP-глагол соответственно
Class MyVerbs(MethodView):
@require_oauth(domain.group:read)
def post(data):
Здесь все становится интереснее.Да, я использую другой сервер для получения токенов, но храню токен на локальном сервере oauth2.Это на тот случай, если мы решим поддержать наш собственный oauth2.
Сказав, что при отправке данных на URL, который поддерживает этот MethodView, токен извлекается с перерывами.Я пробовал разные конфигурации в запросе db.Model и даже пошел прямо баллистический sql, однако результаты остались прежними.Пожалуйста, сообщите
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3"
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 401 138 "-" "python-requests/2.12.3”
10.81.72.150 - - [10/Jun/2019:17:14:09 +0000] "GET /v1 HTTP/1.1" 200 201 "-" "python-requests/2.12.3"