<s> import json <EOL> import logging <EOL> import socket <EOL> from django . utils . translation import ugettext as _ <EOL> from sqoop import client , conf <EOL> from desktop . lib . django_util import JsonResponse <EOL> from desktop . lib . exceptions import StructuredException <EOL> from desktop . lib . rest . http_client import RestException <EOL> from exception import handle_rest_exception <EOL> from django . views . decorators . cache import never_cache <EOL> __all__ = [ '<STR_LIT>' ] <EOL> LOG = logging . getLogger ( __name__ ) <EOL> @ never_cache <EOL> def driver ( request ) : <EOL> response = { <EOL> '<STR_LIT:status>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : None <EOL> } <EOL> if request . method == '<STR_LIT:GET>' : <EOL> try : <EOL> c = client . SqoopClient ( conf . SERVER_URL . get ( ) , request . user . username , request . LANGUAGE_CODE ) <EOL> response [ '<STR_LIT>' ] = c . get_driver ( ) . to_dict ( ) <EOL> except RestException , e : <EOL> response . update ( handle_rest_exception ( e , _ ( '<STR_LIT>' ) ) ) <EOL> return JsonResponse ( response ) <EOL> else : <EOL> raise StructuredException ( code = "<STR_LIT>" , message = _ ( '<STR_LIT>' ) , error_code = <NUM_LIT> ) </s>
