Did I find the right examples for you? yes no

All Samples(777)  |  Call(694)  |  Derive(0)  |  Import(83)
Parse a Content-type like header.

Return the main content-type and a dictionary of options.

        def parse_header(line):
    """Parse a Content-type like header.

    Return the main content-type and a dictionary of options.

    """
    parts = _parseparam(';' + line)
    key = parts.next()
    pdict = {}
    for p in parts:
        i = p.find('=')
        if i >= 0:
            name = p[:i].strip().lower()
            value = p[i+1:].strip()
            if len(value) >= 2 and value[0] == value[-1] == '"':
                value = value[1:-1]
                value = value.replace('\\\\', '\\').replace('\\"', '"')
            pdict[name] = value
    return key, pdict
        


src/p/l/plaidcloud_agent-HEAD/plaidcloudexamples/uploadnoticer.py   plaidcloud_agent(Download)
    def do_POST(self):
        ctype, pdict = cgi.parse_header(self.headers.getheader('content-type'))
        if ctype == 'multipart/form-data':
            postvars = cgi.parse_multipart(self.rfile, pdict)
        elif ctype == 'application/x-www-form-urlencoded':

src/p/l/plaidcloud_agent-HEAD/plaidcloudexamples/helloserver.py   plaidcloud_agent(Download)
    def do_POST(self):
        ctype, pdict = cgi.parse_header(self.headers.getheader('content-type'))
        if ctype == 'multipart/form-data':
            postvars = cgi.parse_multipart(self.rfile, pdict)
        elif ctype == 'application/x-www-form-urlencoded':

src/p/l/plaidcloud_agent-HEAD/plaidcloudexamples/dataserver.py   plaidcloud_agent(Download)
    def do_POST(self):
        ctype, pdict = cgi.parse_header(self.headers.getheader('content-type'))
        if ctype == 'multipart/form-data':
            postvars = cgi.parse_multipart(self.rfile, pdict)
        elif ctype == 'application/x-www-form-urlencoded':

src/p/l/plaidcloud_agent-HEAD/plaidcloudexamples/beerserver.py   plaidcloud_agent(Download)
    def do_POST(self):
        ctype, pdict = cgi.parse_header(self.headers.getheader('content-type'))
        if ctype == 'multipart/form-data':
            postvars = cgi.parse_multipart(self.rfile, pdict)
        elif ctype == 'application/x-www-form-urlencoded':

src/k/u/kuma-lib-HEAD/packages/html5lib/examples/parse.py   kuma-lib(Download)
                contentType = f.headers.get('content-type')
                if contentType:
                    (mediaType, params) = cgi.parse_header(contentType)
                    encoding = params.get('charset')
            except: pass

src/p/o/pony-build-HEAD/examples/push-cgi-notifier/feedparser.py   pony-build(Download)
        '''
        content_type = content_type or ''
        content_type, params = cgi.parse_header(content_type)
        return content_type, params.get('charset', '').replace("'", '')
 

src/t/r/trollius-0.2/examples/crawl.py   trollius(Download)
                self.pdict = {}
                if self.ctype:
                    self.ctype, self.pdict = cgi.parse_header(self.ctype)
                self.encoding = self.pdict.get('charset', 'utf-8')
                if self.ctype == 'text/html':

src/p/l/playlist-import-example-HEAD/feedparser.py   playlist-import-example(Download)
        '''
        content_type = content_type or ''
        content_type, params = cgi.parse_header(content_type)
        return content_type, params.get('charset', '').replace("'", '')
 

src/e/r/erp5-HEAD/product/ERP5Wizard/Tool/WizardTool.py   erp5(Download)
        if content_type:
          content_type_value, content_type_dict = cgi.parse_header(
              content_type)
        if content_type_value == 'multipart/form-data':
          fp = StringIO(user_input)

src/s/p/spambayes-1.1b1/spambayes/Dibbler.py   spambayes(Download)
            match = re.search(r'(?i)content-type:\s*([^\r\n]+)', headers)
            contentTypeHeader = match.group(1)
            contentType, pdict = cgi.parse_header(contentTypeHeader)
            if contentType == 'multipart/form-data':
                # multipart/form-data - probably a file upload.

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next