You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

432 lines
11 KiB

4 years ago
  1. Metadata-Version: 2.0
  2. Name: qrcode
  3. Version: 6.0
  4. Summary: QR Code image generator
  5. Home-page: https://github.com/lincolnloop/python-qrcode
  6. Author: Lincoln Loop
  7. Author-email: info@lincolnloop.com
  8. License: BSD
  9. Keywords: django,countries,flags
  10. Platform: UNKNOWN
  11. Classifier: Development Status :: 5 - Production/Stable
  12. Classifier: License :: OSI Approved :: BSD License
  13. Classifier: Operating System :: OS Independent
  14. Classifier: Intended Audience :: Developers
  15. Classifier: Programming Language :: Python
  16. Classifier: Programming Language :: Python :: 2.7
  17. Classifier: Programming Language :: Python :: 3.4
  18. Classifier: Programming Language :: Python :: 3.5
  19. Classifier: Programming Language :: Python :: 3.6
  20. Classifier: Topic :: Multimedia :: Graphics
  21. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  22. Provides-Extra: test
  23. Provides-Extra: pil
  24. Provides-Extra: maintainer
  25. Provides-Extra: dev
  26. Requires-Dist: six
  27. Requires-Dist: colorama; platform_system == "Windows"
  28. Provides-Extra: dev
  29. Requires-Dist: tox; extra == 'dev'
  30. Requires-Dist: pytest; extra == 'dev'
  31. Provides-Extra: dev
  32. Requires-Dist: mock; python_version < "3" and extra == 'dev'
  33. Provides-Extra: maintainer
  34. Requires-Dist: zest.releaser[recommended]; extra == 'maintainer'
  35. Provides-Extra: pil
  36. Requires-Dist: pillow; extra == 'pil'
  37. Provides-Extra: test
  38. Requires-Dist: pytest; extra == 'test'
  39. Requires-Dist: pytest-cov; extra == 'test'
  40. Provides-Extra: test
  41. Requires-Dist: mock; python_version < "3" and extra == 'test'
  42. =============================
  43. Pure python QR Code generator
  44. =============================
  45. Generate QR codes.
  46. For a standard install (which will include pillow_ for generating images),
  47. run::
  48. pip install qrcode[pil]
  49. .. _pillow: https://pypi.python.org/pypi/Pillow
  50. What is a QR Code?
  51. ==================
  52. A Quick Response code is a two-dimensional pictographic code used for its fast
  53. readability and comparatively large storage capacity. The code consists of
  54. black modules arranged in a square pattern on a white background. The
  55. information encoded can be made up of any kind of data (e.g., binary,
  56. alphanumeric, or Kanji symbols)
  57. Usage
  58. =====
  59. From the command line, use the installed ``qr`` script::
  60. qr "Some text" > test.png
  61. Or in Python, use the ``make`` shortcut function:
  62. .. code:: python
  63. import qrcode
  64. img = qrcode.make('Some data here')
  65. Advanced Usage
  66. --------------
  67. For more control, use the ``QRCode`` class. For example:
  68. .. code:: python
  69. import qrcode
  70. qr = qrcode.QRCode(
  71. version=1,
  72. error_correction=qrcode.constants.ERROR_CORRECT_L,
  73. box_size=10,
  74. border=4,
  75. )
  76. qr.add_data('Some data')
  77. qr.make(fit=True)
  78. img = qr.make_image(fill_color="black", back_color="white")
  79. The ``version`` parameter is an integer from 1 to 40 that controls the size of
  80. the QR Code (the smallest, version 1, is a 21x21 matrix).
  81. Set to ``None`` and use the ``fit`` parameter when making the code to determine
  82. this automatically.
  83. ``fill_color`` and ``back_color`` can change the background and the painting
  84. color of the QR, when using the default image factory.
  85. The ``error_correction`` parameter controls the error correction used for the
  86. QR Code. The following four constants are made available on the ``qrcode``
  87. package:
  88. ``ERROR_CORRECT_L``
  89. About 7% or less errors can be corrected.
  90. ``ERROR_CORRECT_M`` (default)
  91. About 15% or less errors can be corrected.
  92. ``ERROR_CORRECT_Q``
  93. About 25% or less errors can be corrected.
  94. ``ERROR_CORRECT_H``.
  95. About 30% or less errors can be corrected.
  96. The ``box_size`` parameter controls how many pixels each "box" of the QR code
  97. is.
  98. The ``border`` parameter controls how many boxes thick the border should be
  99. (the default is 4, which is the minimum according to the specs).
  100. Other image factories
  101. =====================
  102. You can encode as SVG, or use a new pure Python image processor to encode to
  103. PNG images.
  104. The Python examples below use the ``make`` shortcut. The same ``image_factory``
  105. keyword argument is a valid option for the ``QRCode`` class for more advanced
  106. usage.
  107. SVG
  108. ---
  109. You can create the entire SVG or an SVG fragment. When building an entire SVG
  110. image, you can use the factory that combines as a path (recommended, and
  111. default for the script) or a factory that creates a simple set of rectangles.
  112. From your command line::
  113. qr --factory=svg-path "Some text" > test.svg
  114. qr --factory=svg "Some text" > test.svg
  115. qr --factory=svg-fragment "Some text" > test.svg
  116. Or in Python:
  117. .. code:: python
  118. import qrcode
  119. import qrcode.image.svg
  120. if method == 'basic':
  121. # Simple factory, just a set of rects.
  122. factory = qrcode.image.svg.SvgImage
  123. elif method == 'fragment':
  124. # Fragment factory (also just a set of rects)
  125. factory = qrcode.image.svg.SvgFragmentImage
  126. else:
  127. # Combined path factory, fixes white space that may occur when zooming
  128. factory = qrcode.image.svg.SvgPathImage
  129. img = qrcode.make('Some data here', image_factory=factory)
  130. Two other related factories are available that work the same, but also fill the
  131. background of the SVG with white::
  132. qrcode.image.svg.SvgFillImage
  133. qrcode.image.svg.SvgPathFillImage
  134. Pure Python PNG
  135. ---------------
  136. Install the following two packages::
  137. pip install git+git://github.com/ojii/pymaging.git#egg=pymaging
  138. pip install git+git://github.com/ojii/pymaging-png.git#egg=pymaging-png
  139. From your command line::
  140. qr --factory=pymaging "Some text" > test.png
  141. Or in Python:
  142. .. code:: python
  143. import qrcode
  144. from qrcode.image.pure import PymagingImage
  145. img = qrcode.make('Some data here', image_factory=PymagingImage)
  146. ==========
  147. Change log
  148. ==========
  149. 6.0 (23 March 2018)
  150. ===================
  151. - Fix optimize length being ignored in ``QRCode.add_data``.
  152. - Better calculation of the best mask pattern and related optimizations. Big
  153. thanks to cryptogun!
  154. 5.3 (18 May 2016)
  155. =================
  156. * Fix incomplete block table for QR version 15. Thanks Rodrigo Queiro for the
  157. report and Jacob Welsh for the investigation and fix.
  158. * Avoid unnecessary dependency for non MS platforms, thanks to Noah Vesely.
  159. * Make ``BaseImage.get_image()`` actually work.
  160. 5.2 (25 Jan 2016)
  161. =================
  162. * Add ``--error-correction`` option to qr script.
  163. * Fix script piping to stdout in Python 3 and reading non-UTF-8 characters in
  164. Python 3.
  165. * Fix script piping in Windows.
  166. * Add some useful behind-the-curtain methods for tinkerers.
  167. * Fix terminal output when using Python 2.6
  168. * Fix terminal output to display correctly on MS command line.
  169. 5.2.1
  170. -----
  171. * Small fix to terminal output in Python 3 (and fix tests)
  172. 5.2.2
  173. -----
  174. * Revert some terminal changes from 5.2 that broke Python 3's real life tty
  175. code generation and introduce a better way from Jacob Welsh.
  176. 5.1 (22 Oct 2014)
  177. =================
  178. * Make ``qr`` script work in Windows. Thanks Ionel Cristian Mărieș
  179. * Fixed print_ascii function in Python 3.
  180. * Out-of-bounds code version numbers are handled more consistently with a
  181. ValueError.
  182. * Much better test coverage (now only officially supporting Python 2.6+)
  183. 5.0 (17 Jun 2014)
  184. =================
  185. * Speed optimizations.
  186. * Change the output when using the ``qr`` script to use ASCII rather than
  187. just colors, better using the terminal real estate.
  188. * Fix a bug in passing bytecode data directly when in Python 3.
  189. * Substation speed optimizations to best-fit algorithm (thanks Jacob Welsh!).
  190. * Introduce a ``print_ascii`` method and use it as the default for the ``qr``
  191. script rather than ``print_tty``.
  192. 5.0.1
  193. -----
  194. * Update version numbers correctly.
  195. 4.0 (4 Sep 2013)
  196. ================
  197. * Made qrcode work on Python 2.4 - Thanks tcely.
  198. Note: officially, qrcode only supports 2.5+.
  199. * Support pure-python PNG generation (via pymaging) for Python 2.6+ -- thanks
  200. Adam Wisniewski!
  201. * SVG image generation now supports alternate sizing (the default box size of
  202. 10 == 1mm per rectangle).
  203. * SVG path image generation allows cleaner SVG output by combining all QR rects
  204. into a single path. Thank you, Viktor Stískala.
  205. * Added some extra simple SVG factories that fill the background white.
  206. 4.0.1
  207. -----
  208. * Fix the pymaging backend not able to save the image to a buffer. Thanks ilj!
  209. 4.0.2
  210. -----
  211. * Fix incorrect regex causing a comma to be considered part of the alphanumeric
  212. set.
  213. * Switch to using setuptools for setup.py.
  214. 4.0.3
  215. -----
  216. * Fix bad QR code generation due to the regex comma fix in version 4.0.2.
  217. 4.0.4
  218. -----
  219. * Bad version number for previous hotfix release.
  220. 3.1 (12 Aug 2013)
  221. =================
  222. * Important fixes for incorrect matches of the alpha-numeric encoding mode.
  223. Previously, the pattern would match if a single line was alpha-numeric only
  224. (even if others wern't). Also, the two characters ``{`` and ``}`` had snuck
  225. in as valid characters. Thanks to Eran Tromer for the report and fix.
  226. * Optimized chunking -- if the parts of the data stream can be encoded more
  227. efficiently, the data will be split into chunks of the most efficient modes.
  228. 3.1.1
  229. -----
  230. * Update change log to contain version 3.1 changes. :P
  231. * Give the ``qr`` script an ``--optimize`` argument to control the chunk
  232. optimization setting.
  233. 3.0 (25 Jun 2013)
  234. =================
  235. * Python 3 support.
  236. * Add QRCode.get_matrix, an easy way to get the matrix array of a QR code
  237. including the border. Thanks Hugh Rawlinson.
  238. * Add in a workaround so that Python 2.6 users can use SVG generation (they
  239. must install ``lxml``).
  240. * Some initial tests! And tox support (``pip install tox``) for testing across
  241. Python platforms.
  242. 2.7 (5 Mar 2013)
  243. ================
  244. * Fix incorrect termination padding.
  245. 2.6 (2 Apr 2013)
  246. ================
  247. * Fix the first four columns incorrectly shifted by one. Thanks to Josep
  248. Gómez-Suay for the report and fix.
  249. * Fix strings within 4 bits of the QR version limit being incorrectly
  250. terminated. Thanks to zhjie231 for the report.
  251. 2.5 (12 Mar 2013)
  252. =================
  253. * The PilImage wrapper is more transparent - you can use any methods or
  254. attributes available to the underlying PIL Image instance.
  255. * Fixed the first column of the QR Code coming up empty! Thanks to BecoKo.
  256. 2.5.1
  257. -----
  258. * Fix installation error on Windows.
  259. 2.4 (23 Apr 2012)
  260. =================
  261. * Use a pluggable backend system for generating images, thanks to Branko Čibej!
  262. Comes with PIL and SVG backends built in.
  263. 2.4.1
  264. -----
  265. * Fix a packaging issue
  266. 2.4.2
  267. -----
  268. * Added a ``show`` method to the PIL image wrapper so the ``run_example``
  269. function actually works.
  270. 2.3 (29 Jan 2012)
  271. =================
  272. * When adding data, auto-select the more efficient encoding methods for numbers
  273. and alphanumeric data (KANJI still not supported).
  274. 2.3.1
  275. -----
  276. * Encode unicode to utf-8 bytestrings when adding data to a QRCode.
  277. 2.2 (18 Jan 2012)
  278. =================
  279. * Fixed tty output to work on both white and black backgrounds.
  280. * Added `border` parameter to allow customizing of the number of boxes used to
  281. create the border of the QR code
  282. 2.1 (17 Jan 2012)
  283. =================
  284. * Added a ``qr`` script which can be used to output a qr code to the tty using
  285. background colors, or to a file via a pipe.