from blckur.constants import *
from blckur.exceptions import *
from blckur import filter
from blckur import formatter
from blckur import handler
from blckur import test_case

import time
import requests

class Base(object):
    base_url = None
    filter = filter.ReportFilter()
    formatter = formatter.ReportFormatter()
    handler = handler.ReportHandler()
    request_kwargs = None
    request_time = None

    def __init__(self):
        self.objects = {}
        self.requests = requests.request

    @property
    def TestCase(self):
        return type('TestCase', (test_case.TestCase,), {
            'base': self,
        })

    def main(self):
        module = __import__('__main__')

        for name in dir(module):
            obj = getattr(module, name)
            if isinstance(obj, type) and \
                    issubclass(obj, test_case.TestCase) and \
                    obj.base == self and obj not in self.objects:
                obj()

    def handle_request(self, method, url, **kwargs):
        if self.request_kwargs:
            kwargs.update(self.request_kwargs)

        start = time.time()
        response = self.request(method, url, **kwargs)
        self.request_time = int((time.time() - start) * 1000)

        return response

    def request(self, method, url, headers=None, json=None,
            params=None, data=None, **kwargs):
        return self.requests.request(
            method,
            url,
            headers=headers,
            json=json,
            params=params,
            data=data,
            **kwargs
        )

class SessionBase(Base):
    def __init__(self):
        Base.__init__(self)
        self.requests = requests.Session()

        self.request(
            self.method,
            self.base_url + self.path,
            json=self.input_json,
            params=self.input_params,
            data=self.input_data,
        )

@@ -1702,93 +1702,685 @@
 n()%0A
-%0A        self.request(%0A            self.method,%0A            self.base_url + self.path
+        self.init_session()%0A%0A    def _get_attr(self, name, default=None):%0A        if hasattr(self, name):%0A            return getattr(self, name)%0A        return default%0A%0A    def init_session(self):%0A        test_case = type('SessionInitTestCase', (self.TestCase,), %7B%0A            'base': self,%0A            'require': self._get_attr('require'),%0A            'required': self._get_attr('required', True),%0A            'method': self._get_attr('method'),%0A            'path': self._get_attr('path'),%0A            'expect_status': self._get_attr('expect_status'),%0A            'input_headers': self._get_attr('input_headers'),%0A            'expect_headers': self._get_attr('expect_headers')
 ,%0A  
@@ -2393,18 +2393,38 @@
     
+'input_
 json
-=
+': 
 self.
+_get_attr('
 inpu
@@ -2425,24 +2425,26 @@
 ('input_json
+')
 ,%0A          
@@ -2449,20 +2449,40 @@
     
+'input_
 params
-=
+': 
 self.
+_get_attr('
 inpu
@@ -2485,24 +2485,26 @@
 input_params
+')
 ,%0A          
@@ -2509,36 +2509,201 @@
     
+'input_
 data
-=
+': 
 self.
-input_data,%0A        
+_get_attr('input_data'),%0A            'expect_json': self._get_attr('expect_json'),%0A            'request_kwargs': self._get_attr('request_kwargs'),%0A        %7D)%0A        test_case(
 )%0A

Use test_case for base session