# Path: roscraco/exception.py
# class RouterFetchError(RouterError):
#     pass


import sys
import base64
import contextlib
    import urllib.parse as urlencoder
    import urllib as urlencoder
    import urllib.request as requestor
    import urllib2 as requestor
from roscraco.exception import RouterFetchError

        The result is a 3-tuple:
            - requested URL
            - info() - meta information, such as headers
            - contents
        """
        if self._is_first_request:
            self._is_first_request = False
            self._handle_first_request()

        if data is not None:
            if isinstance(data, dict) or isinstance(data, list):
                data = urlencoder.urlencode(data)
            else:
                raise RouterFetchError(
                    'POST data should be a dict, a list or None!'
                )

        try:
            req = requestor.Request(url, data)
            for header, value in headers:
                req.add_header(header, value)
            with contextlib.closing(requestor.urlopen(req, timeout=timeout)) as handle:
                self._is_logged_in = True
                return (
                    handle.geturl(),
                    handle.info(),
                    handle.read().decode('utf-8', 'ignore')
                )
        except Exception as e:

# Path: roscraco/exception.py
# class RouterFetchError(RouterError):
#     pass


# Path: roscraco/router/base.py
import sys
import base64
import contextlib
    import urllib.parse as urlencoder
    import urllib as urlencoder
    import urllib.request as requestor
    import urllib2 as requestor
from roscraco.exception import RouterFetchError


        The result is a 3-tuple:
            - requested URL
            - info() - meta information, such as headers
            - contents
        """
        if self._is_first_request:
            self._is_first_request = False
            self._handle_first_request()

        if data is not None:
            if isinstance(data, dict) or isinstance(data, list):
                data = urlencoder.urlencode(data)
            else:
                raise RouterFetchError(
                    'POST data should be a dict, a list or None!'
                )

        try:
            req = requestor.Request(url, data)
            for header, value in headers:
                req.add_header(header, value)
            with contextlib.closing(requestor.urlopen(req, timeout=timeout)) as handle:
                self._is_logged_in = True
                return (
                    handle.geturl(),
                    handle.info(),
                    handle.read().decode('utf-8', 'ignore')
                )
        except Exception as e:

            raise RouterFetchError('Failed making request: %s' % repr(e))