Giter Club home page Giter Club logo

Comments (4)

dbtsai avatar dbtsai commented on June 30, 2024

Yup, also: '/,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,image/png,;q=0.5, application/vnd.nokia.headwrapper'

from python-mimeparse.

dbtsai avatar dbtsai commented on June 30, 2024

Specifically, this breaks the parser: /,text/xml

from python-mimeparse.

zbyte64 avatar zbyte64 commented on June 30, 2024

I get the same issue:

>>> import mimeparse
>>> mimeparse.parse_mime_type('text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/jason/Repos/hyperadmindemo/local/lib/python2.7/site-packages/mimeparse.py", line 38, in parse_mime_type
    (type, subtype) = full_type.split("/")
ValueError: too many values to unpack

from python-mimeparse.

pjz avatar pjz commented on June 30, 2024

parse_mime_type() is for parsing one mime type, possibly with quality metrics, not for parsing a list of mime types. If you want to parse a list, split the list on commas then feed each result to parse_mime_type(), like:

types = [ mimeparse.parse_mime_type(t) for t in "/,text/html".split('.') ]

from python-mimeparse.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.