def modify_request(self, http_request):
    """Changes the HTTP request before sending it to the server.

    Sets the User-Agent HTTP header and fills in the HTTP host portion
    of the URL if one was not included in the request (for this it uses
    the self.host member if one is set). This method is called in
    self.request.

    Args:
      http_request: An atom.http_core.HttpRequest() (optional) If one is
                    not provided, a new HttpRequest is instantiated.

    Returns:
      An atom.http_core.HttpRequest() with the User-Agent header set and
      if this client has a value in its host member, the host in the request
      URL is set.
    """
    if http_request is None:
      http_request = atom.http_core.HttpRequest()

    if self.host is not None and http_request.uri.host is None:
      http_request.uri.host = self.host

    if self.xoauth_requestor_id is not None:
      http_request.uri.query['xoauth_requestor_id'] = self.xoauth_requestor_id

    # Set the user agent header for logging purposes.
    if self.source:
      http_request.headers['User-Agent'] = '%s gdata-py/2.0.16' % self.source
    else:
      http_request.headers['User-Agent'] = 'gdata-py/2.0.16'

    return http_request
dataset/ETHPy150Open kuri65536/python-for-android/python3-alpha/python-libs/atom/client.py/AtomPubClient.modify_request/original