parameters: (self, auth)
docstring: Generates a private key for the stored |host_id|, and registers it with
      the Directory service.
  
      Args:
        auth: Authentication object with credentials for authenticating with the
          Directory service.
  
      Raises:
        urllib2.HTTPError: An error occurred talking to the Directory server
          (for example, if the |auth| credentials were rejected).
docstring_summary: Generates a private key for the stored |host_id|, and registers it with
      the Directory service.
docstring_tokens: Generates a private key for the stored |host_id| and registers it with the Directory service .
function: def register(self, auth):
      """Generates a private key for the stored |host_id|, and registers it with
      the Directory service.
  
      Args:
        auth: Authentication object with credentials for authenticating with the
          Directory service.
  
      Raises:
        urllib2.HTTPError: An error occurred talking to the Directory server
          (for example, if the |auth| credentials were rejected).
      """
  
      logging.info("HostId: " + self.host_id)
      logging.info("HostName: " + self.host_name)
  
      logging.info("Generating RSA key pair...")
      (self.private_key, public_key) = keygen.generateRSAKeyPair()
      logging.info("Done")
  
      json_data = {
          "data": {
              "hostId": self.host_id,
              "hostName": self.host_name,
              "publicKey": public_key,
          }
      }
      params = json.dumps(json_data)
      headers = {
          "Authorization": "GoogleLogin auth=" + auth.chromoting_auth_token,
          "Content-Type": "application/json",
      }
  
      request = urllib2.Request(self.url, params, headers)
      opener = urllib2.OpenerDirector()
      opener.add_handler(urllib2.HTTPDefaultErrorHandler())
  
      logging.info("Registering host with directory service...")
  
      res = urllib2.urlopen(request)
      data = res.read()
  
      logging.info("Done")
function_tokens: def register ( self , auth ) : logging . info ( "HostId: " + self . host_id ) logging . info ( "HostName: " + self . host_name ) logging . info ( "Generating RSA key pair..." ) ( self . private_key , public_key ) = keygen . generateRSAKeyPair ( ) logging . info ( "Done" ) json_data = { "data" : { "hostId" : self . host_id , "hostName" : self . host_name , "publicKey" : public_key , } } params = json . dumps ( json_data ) headers = { "Authorization" : "GoogleLogin auth=" + auth . chromoting_auth_token , "Content-Type" : "application/json" , } request = urllib2 . Request ( self . url , params , headers ) opener = urllib2 . OpenerDirector ( ) opener . add_handler ( urllib2 . HTTPDefaultErrorHandler ( ) ) logging . info ( "Registering host with directory service..." ) res = urllib2 . urlopen ( request ) data = res . read ( ) logging . info ( "Done" )