fcurella / python-datauri Goto Github PK
View Code? Open in Web Editor NEWData URI manipulation made easy.
License: The Unlicense
Data URI manipulation made easy.
License: The Unlicense
DataURI.Make(....) produces a class of type DataURI. I don't see any methods of then taking that to a bytestring that can be sent to the browser.
This is possible via python-magic
and libmagic
.
I have coded this one for another package, here.
python-datauri/datauri/__init__.py
Line 68 in 0e8c0ae
I think it should be open(..., encoding=charset)
otherwise the file encoded in other codes than utf-8 cannot be opened in the first place.
Would be nice to expose the existing regex code so it has a .discover(...) method, so that I can search a body for potential candidates..
DATA_URI_REGEX = (
r'data:' +
r'(?P<mimetype>{})?'.format(MIMETYPE_REGEX) +
r"(?:\;name\=(?P<name>[\w\.\-%!*'~\(\)]+))?" +
r'(?:\;charset\=(?P<charset>{}))?'.format(CHARSET_REGEX) +
r'(?P<base64>\;base64)?' +
r',(?P<data>.*)')
_DATA_URI_RE = re.compile(r'^{}$'.format(DATA_URI_REGEX), re.DOTALL)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.