Giter Club home page Giter Club logo

mime-streamer's People

Contributors

okomestudio avatar

Watchers

 avatar  avatar  avatar

mime-streamer's Issues

Handle when non-XOP response is fed to XOPResponseStreamer

Currently, non-XOP response isn't gracefully handled when XOPResponseStreamer is initialized with one:

    xop = XOPResponseStreamer(resp)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <XOPResponseStreamer>, resp = <Response [500]>

    def __init__(self, resp):
        super(XOPResponseStreamer, self).__init__(resp)
>       if self._ct_params['mime-type'].lower() != 'multipart/related':
E       AttributeError: 'XOPResponseStreamer' object has no attribute '_ct_params'

../../../.virtualenvs/ingester/local/lib/python2.7/site-packages/mime_streamer/mime_response_streamer.py:110: AttributeError

Add more informative message when this happens.

Allow content stream not be flushed as an option

This would be useful when flushing the read content is desired when an error is encountered while stream parsing the content. Perhaps add an optional argument to get_next_part to switch the behavior within the context manager.

Handle delimiting properly when different newlines are mixed requests' Response.iter_lines

Multipart document can mix different newline sequence, e.g., the envelope assumes \r\n as the canonical newline but content body embedded within a part can be multiline content delimited with \n. In such a case, iter_lines does not delimit on \n, making stream-reading continue on until the full body is ready, which is a problem when the body is huge.

Fix it so that lines are constructed generically on any valid newline, but be careful to keep the newline actually used (i.e., do not assume all lines are delimited by \r\n as in multipart message spec) and not to modify the actual byte sequence.

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.