from django.core.management import BaseCommand
import logging

# These two lines enable debugging at httplib level (requests->urllib3->http.client)
# You will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA.
# The only thing missing will be the response.body which is not logged.
try:
    import http.client as http_client
except ImportError:
    # Python 2
    import httplib as http_client
http_client.HTTPConnection.debuglevel = 1

# You must initialize logging, otherwise you'll not see debug output.
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True

class Command(BaseCommand):
    def handle(self, *args, **options):
        from exporter.tasks import GenerateModelExportTask
        gmet = GenerateModelExportTask()
        gmet.run(1)
[((15, 0, 15, 21), 'logging.basicConfig', 'logging.basicConfig', ({}, {}), '()', False, 'import logging\n'), ((17, 15, 17, 61), 'logging.getLogger', 'logging.getLogger', ({(17, 33, 17, 60): '"""requests.packages.urllib3"""'}, {}), "('requests.packages.urllib3')", False, 'import logging\n'), ((16, 0, 16, 19), 'logging.getLogger', 'logging.getLogger', ({}, {}), '()', False, 'import logging\n'), ((24, 15, 24, 40), 'exporter.tasks.GenerateModelExportTask', 'GenerateModelExportTask', ({}, {}), '()', False, 'from exporter.tasks import GenerateModelExportTask\n')]