# Path: lib/errors.py
# class SessionExpiredError(Error):
#     def __init__(self, message="Session has expired."):
#         super(SessionExpiredError, self).__init__()
#         self.message = message
# 
# class SessionConsumedError(Error):
#     def __init__(self, message="Session has been consumed."):
#         super(SessionConsumedError, self).__init__()
#         self.message = message


import uuid
import string
import hashlib
import logging
from lib.errors import SessionExpiredError, SessionConsumedError
from datetime import datetime as dt
from random import SystemRandom
# coding:utf-8

LOG = logging.getLogger("errbot.plugin.st2.session")


def generate_password(length=8):
    rnd = SystemRandom()
    if length > 255:
        length = 255

# Path: lib/errors.py
# class SessionExpiredError(Error):
#     def __init__(self, message="Session has expired."):
#         super(SessionExpiredError, self).__init__()
#         self.message = message
# 
# class SessionConsumedError(Error):
#     def __init__(self, message="Session has been consumed."):
#         super(SessionConsumedError, self).__init__()
#         self.message = message


# Path: lib/session.py
import uuid
import string
import hashlib
import logging
from lib.errors import SessionExpiredError, SessionConsumedError
from datetime import datetime as dt
from random import SystemRandom

# coding:utf-8

LOG = logging.getLogger("errbot.plugin.st2.session")


def generate_password(length=8):
    rnd = SystemRandom()
    if length > 255:
        length = 255

    return "".join([rnd.choice(string.hexdigits) for _ in range(length)])