def _GenClientLibFromContents(discovery_doc, language, output_path, client_name):
 body = urllib.urlencode({'lang': language, 'content': discovery_doc})
 request = urllib2.Request(CLIENT_LIBRARY_BASE, body)
 try:
  with contextlib.closing(urllib2.urlopen(request)) as response:
   content = response.read()
   return _WriteFile(output_path, client_name, content)
 except urllib2.HTTPError as error:
  raise ServerRequestException(error)

def _GenClientLibFromContents ( discovery_doc , language , output_path , client_name ) : body = urllib . urlencode ( { 'lang' : language , 'content' : discovery_doc } ) request = urllib2 . Request ( CLIENT_LIBRARY_BASE , body ) try : with contextlib . closing ( urllib2 . urlopen ( request ) ) as response : content = response . read ( ) return _WriteFile ( output_path , client_name , content ) except urllib2 . HTTPError as error : raise ServerRequestException ( error )
write a client library from a discovery doc .