def request(self, method, url, params=None, data=None, headers=None,
                cookies=None, files=None, auth=None, timeout=None,
                max_redirects=None, keep_alive=None):
        method = str(method).upper()

        # Parse the URL.
        parts = urlparse.urlparse(url)
        if not parts.scheme in ("http", "https"):
            raise ValueError("HTTPClient unable to serve request with scheme "
                             "%r." % parts.scheme)

        # Get default values from the session if necessary
        if timeout is None:
            timeout = self.timeout
        if max_redirects is None:
            max_redirects = self.max_redirects
        if keep_alive is None:
            keep_alive = self.keep_alive
        if auth is None:
            auth = self.auth
        if cookies is None:
            cookies = self.cookies
        elif isinstance(cookies, dict):
            cookies = Cookie.SimpleCookie(cookies)

        # Build the headers.
        if not headers:
            headers = {}

        # Update with all the default headers.
        for key in self.headers:
            if not key in headers:
                headers[key] = self.headers[key]

        # Add an extra header or two.
        if not 'Accept-Encoding' in headers:
            headers['Accept-Encoding'] = 'deflate, gzip'

        if not 'Date' in headers:
            headers['Date'] = date(datetime.utcnow())

        if not 'Host' in headers:
            headers['Host'] = _hostname(parts)
            port = _port(parts)
            if port:
                headers['Host'] += ':%d' % port

        if not 'User-Agent' in headers:
            headers['User-Agent'] = USER_AGENT

        if not 'Connection' in headers and not keep_alive:
            headers['Connection'] = 'close'

        # Determine the Content-Type of the request body.
        if files:
            hdr = headers.get('Content-Type')
            if hdr and not hdr.startswith("multipart/form-data"):
                raise ValueError("Cannot transmit files with Content-Type "
                                 "%r." % hdr)
            elif not hdr:
                headers['Content-Type'] = 'multipart/form-data'
        elif not 'Content-Type' in headers and data:
            headers['Content-Type'] = 'application/x-www-form-urlencoded'

        # Construct the actual request body. This is a mess.
        if 'Content-Type' in headers:
            hdr = headers['Content-Type']
            if isinstance(data, bytes):
                body = [data]
                length = len(data)
            elif hdr.startswith('multipart/form-data'):
                ind = hdr.find('boundary=')
                if ind != -1:
                    boundary = hdr[ind+9:]
                else:
                    boundary = None

                boundary, body = encode_multipart(data or {}, files, boundary)
                headers['Content-Type'] = 'multipart/form-data; boundary=%s' \
                                            % boundary
                length = 0
                for item in body:
                    if isinstance(item, basestring):
                        length += len(item)
                    else:
                        item.seek(0, 2)
                        length += item.tell()
            elif hdr == 'application/x-www-form-urlencoded':
                if isinstance(data, dict):
                    body = [urllib.urlencode(data or {}, True)]
                    length = len(body[0])
                elif not data:
                    body = []
                    length = 0
                else:
                    body = [data]
                    length = len(body[0])
            else:
                raise ValueError("Unknown Content-Type %r." % hdr)
            headers['Content-Length'] = length
        else:
            body = None

        # Deal with the request parameters and the URL fragment.
        path = parts.path or '/'
        if params:
            new_params = urlparse.parse_qs(parts.query)
            for key, value in params.iteritems():
                if not key in new_params:
                    new_params[key] = []
                if isinstance(value, (tuple,list)):
                    new_params[key].extend(value)
                else:
                    new_params[key].append(value)

            # Update the URL parts.
            parts = parts._replace(query=urllib.urlencode(new_params,True))

        if parts.query:
            path += '?%s' % parts.query
        if parts.fragment:
            path += '#%s' % parts.fragment

        # Build our request.
        request = HTTPRequest(self, method, path, parts, headers, cookies,
                                body, timeout, max_redirects, keep_alive, auth)

        # Now, send it back to the client.
        self.client._requests.append(request)
        if not self.client._processing:
            self.client._process()

        # Not sure what you'll do with this, but there you have it.
        return request
Returns all untranslated strings for a language and writes in a file
dataset/ETHPy150Open ecdavis/pants/pants/http/client.py/Session.request--crossover with--dataset/ETHPy150Open frappe/frappe/frappe/translate.py/get_untranslated