GithubHelp home page GithubHelp logo

aktywnitu / rfc6266 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from g2p/rfc6266

0.0 1.0 0.0 300 KB

Content-Disposition header support for Python

License: GNU Lesser General Public License v3.0

Python 100.00%

rfc6266's Introduction

rfc6266

This module parses and generates HTTP Content-Disposition headers. These headers are used when getting resources for download; they provide a hint of whether the file should be downloaded, and of what filename to use when saving.

Usage

Receiver

parse_headers builds a ContentDisposition object from the Content-Disposition header and (as a fallback) the document location. Shortcuts work with response objects from httplib2 and the requests library.

Important attributes of ContentDisposition are is_inline, filename_unsafe, filename_sanitized.

Sender

build_header builds a header value from a filename.

Security

The Content-Disposition filename should be used with caution. Do not let the sender overwrite an arbitrary filesystem location, pick arbitrary extensions or filenames with special meaning, pick filenames containing unusual or misleading characters, etc. Read RFC 6266 section 4.3 for more details.

Testing

To test in the current Python implementation:

py.test

To test compatibility across Python releases:

tox

rfc6266 is currently tested under Python 2.7, Python 2.6, Python 3.3, Python 3.2, and PyPy (1.7).

image

References

rfc6266's People

Contributors

ccorbacho avatar ereon avatar g2p avatar redtoad avatar

Watchers

 avatar

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.