From abbd1117a8ce8cf92a3476b587cc81d7eb4f9ce3 Mon Sep 17 00:00:00 2001 From: Ian Webster Date: Sat, 24 Sep 2022 15:31:22 -0700 Subject: [PATCH 1/4] Update short url example --- examples/short_url_example.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/short_url_example.py b/examples/short_url_example.py index ed59b39..d3b41cf 100644 --- a/examples/short_url_example.py +++ b/examples/short_url_example.py @@ -1,14 +1,15 @@ +import random + from quickchart import QuickChart qc = QuickChart() qc.config = { - "type": "bar", + "type": "line", "data": { - "labels": ["Hello world", "Test"], + "labels": list(range(0, 100)), "datasets": [{ "label": "Foo", - # Count from 0 to 100 - "data": list(range(0, 100)), + "data": random.sample(range(0, 100), 100), }] } } From 12b6a500a3b5f3fd777d0b6503c7226bf2ea4b1e Mon Sep 17 00:00:00 2001 From: Ian Webster Date: Sat, 24 Sep 2022 15:33:28 -0700 Subject: [PATCH 2/4] Set user-agent --- quickchart/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/quickchart/__init__.py b/quickchart/__init__.py index ae57207..2f7e682 100644 --- a/quickchart/__init__.py +++ b/quickchart/__init__.py @@ -10,6 +10,8 @@ # For Python 3 from urllib.parse import urlencode +USER_AGENT = 'quickchart-python (1.0.0)' + FUNCTION_DELIMITER_RE = re.compile('\"__BEGINFUNCTION__(.*?)__ENDFUNCTION__\"') @@ -89,7 +91,10 @@ def _post(self, url): } if self.key: postdata['key'] = self.key - resp = requests.post(url, json=postdata) + headers = { + 'user-agent': USER_AGENT, + } + resp = requests.post(url, json=postdata, headers=headers) if resp.status_code != 200: raise RuntimeError( 'Invalid response code from chart creation endpoint') From 8096fe60c27bbc23b00f248243a405bd90712b1b Mon Sep 17 00:00:00 2001 From: Ian Webster Date: Sat, 24 Sep 2022 15:41:08 -0700 Subject: [PATCH 3/4] v2: drop support for < python 3.7 --- poetry.lock | 117 +++++++++++++++++++++-------------------- pyproject.toml | 6 +-- quickchart/__init__.py | 2 +- 3 files changed, 64 insertions(+), 61 deletions(-) diff --git a/poetry.lock b/poetry.lock index 0dd080a..ce82696 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,121 +1,124 @@ [[package]] -category = "dev" -description = "A tool that automatically formats Python code to conform to the PEP 8 style guide" name = "autopep8" +version = "1.7.0" +description = "A tool that automatically formats Python code to conform to the PEP 8 style guide" +category = "dev" optional = false python-versions = "*" -version = "1.5.5" [package.dependencies] -pycodestyle = ">=2.6.0" +pycodestyle = ">=2.9.1" toml = "*" [[package]] -category = "main" -description = "Python package for providing Mozilla's CA Bundle." name = "certifi" +version = "2022.9.24" +description = "Python package for providing Mozilla's CA Bundle." +category = "main" optional = false -python-versions = "*" -version = "2020.4.5.1" +python-versions = ">=3.6" [[package]] +name = "charset-normalizer" +version = "2.1.1" +description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." category = "main" -description = "Universal encoding detector for Python 2 and 3" -name = "chardet" optional = false -python-versions = "*" -version = "3.0.4" +python-versions = ">=3.6.0" + +[package.extras] +unicode_backport = ["unicodedata2"] [[package]] -category = "main" -description = "Internationalized Domain Names in Applications (IDNA)" name = "idna" +version = "3.4" +description = "Internationalized Domain Names in Applications (IDNA)" +category = "main" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "2.9" +python-versions = ">=3.5" [[package]] -category = "dev" -description = "Python style guide checker" name = "pycodestyle" +version = "2.9.1" +description = "Python style guide checker" +category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "2.6.0" +python-versions = ">=3.6" [[package]] -category = "main" -description = "Python HTTP for Humans." name = "requests" +version = "2.28.1" +description = "Python HTTP for Humans." +category = "main" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "2.23.0" +python-versions = ">=3.7, <4" [package.dependencies] certifi = ">=2017.4.17" -chardet = ">=3.0.2,<4" -idna = ">=2.5,<3" -urllib3 = ">=1.21.1,<1.25.0 || >1.25.0,<1.25.1 || >1.25.1,<1.26" +charset-normalizer = ">=2,<3" +idna = ">=2.5,<4" +urllib3 = ">=1.21.1,<1.27" [package.extras] -security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"] -socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"] +socks = ["PySocks (>=1.5.6,!=1.5.7)"] +use_chardet_on_py3 = ["chardet (>=3.0.2,<6)"] [[package]] -category = "dev" -description = "Python Library for Tom's Obvious, Minimal Language" name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +category = "dev" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -version = "0.10.2" [[package]] -category = "main" -description = "HTTP library with thread-safe connection pooling, file post, and more." name = "urllib3" +version = "1.26.12" +description = "HTTP library with thread-safe connection pooling, file post, and more." +category = "main" optional = false -python-versions = "*" -version = "1.22" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4" [package.extras] -secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] -socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] +secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] +socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [metadata] -content-hash = "810271f04d060914ce66d44fdc2acdbd757749559758e7afb0220abd1cedcfa0" -lock-version = "1.0" -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +lock-version = "1.1" +python-versions = ">=3.7, <4" +content-hash = "1aa6afcebedfcbf9c7ea21f4045e6b59825b1beaadd670bd71db353aac61f2f7" [metadata.files] autopep8 = [ - {file = "autopep8-1.5.5-py2.py3-none-any.whl", hash = "sha256:9e136c472c475f4ee4978b51a88a494bfcd4e3ed17950a44a988d9e434837bea"}, - {file = "autopep8-1.5.5.tar.gz", hash = "sha256:cae4bc0fb616408191af41d062d7ec7ef8679c7f27b068875ca3a9e2878d5443"}, + {file = "autopep8-1.7.0-py2.py3-none-any.whl", hash = "sha256:6f09e90a2be784317e84dc1add17ebfc7abe3924239957a37e5040e27d812087"}, + {file = "autopep8-1.7.0.tar.gz", hash = "sha256:ca9b1a83e53a7fad65d731dc7a2a2d50aa48f43850407c59f6a1a306c4201142"}, ] certifi = [ - {file = "certifi-2020.4.5.1-py2.py3-none-any.whl", hash = "sha256:1d987a998c75633c40847cc966fcf5904906c920a7f17ef374f5aa4282abd304"}, - {file = "certifi-2020.4.5.1.tar.gz", hash = "sha256:51fcb31174be6e6664c5f69e3e1691a2d72a1a12e90f872cbdb1567eb47b6519"}, + {file = "certifi-2022.9.24-py3-none-any.whl", hash = "sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382"}, + {file = "certifi-2022.9.24.tar.gz", hash = "sha256:0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14"}, ] -chardet = [ - {file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"}, - {file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"}, +charset-normalizer = [ + {file = "charset-normalizer-2.1.1.tar.gz", hash = "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845"}, + {file = "charset_normalizer-2.1.1-py3-none-any.whl", hash = "sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"}, ] idna = [ - {file = "idna-2.9-py2.py3-none-any.whl", hash = "sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa"}, - {file = "idna-2.9.tar.gz", hash = "sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb"}, + {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, + {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, ] pycodestyle = [ - {file = "pycodestyle-2.6.0-py2.py3-none-any.whl", hash = "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367"}, - {file = "pycodestyle-2.6.0.tar.gz", hash = "sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"}, + {file = "pycodestyle-2.9.1-py2.py3-none-any.whl", hash = "sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b"}, + {file = "pycodestyle-2.9.1.tar.gz", hash = "sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785"}, ] requests = [ - {file = "requests-2.23.0-py2.7.egg", hash = "sha256:5d2d0ffbb515f39417009a46c14256291061ac01ba8f875b90cad137de83beb4"}, - {file = "requests-2.23.0-py2.py3-none-any.whl", hash = "sha256:43999036bfa82904b6af1d99e4882b560e5e2c68e5c4b0aa03b655f3d7d73fee"}, - {file = "requests-2.23.0.tar.gz", hash = "sha256:b3f43d496c6daba4493e7c431722aeb7dbc6288f52a6e04e7b6023b0247817e6"}, + {file = "requests-2.28.1-py3-none-any.whl", hash = "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"}, + {file = "requests-2.28.1.tar.gz", hash = "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983"}, ] toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, ] urllib3 = [ - {file = "urllib3-1.22-py2.py3-none-any.whl", hash = "sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b"}, - {file = "urllib3-1.22.tar.gz", hash = "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f"}, + {file = "urllib3-1.26.12-py2.py3-none-any.whl", hash = "sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997"}, + {file = "urllib3-1.26.12.tar.gz", hash = "sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e"}, ] diff --git a/pyproject.toml b/pyproject.toml index b9067dc..fd3c977 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "quickchart.io" -version = "1.0.0" +version = "2.0.0" description = "A client for quickchart.io, a service that generates static chart images" keywords = ["chart api", "chart image", "charts"] authors = ["Ian Webster "] @@ -14,8 +14,8 @@ packages = [ ] [tool.poetry.dependencies] -python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -requests = "^2.23.0" +python = ">=3.7, <4" +requests = "^2.28.1" [tool.poetry.dev-dependencies] autopep8 = "^1.5.5" diff --git a/quickchart/__init__.py b/quickchart/__init__.py index 2f7e682..0effb5c 100644 --- a/quickchart/__init__.py +++ b/quickchart/__init__.py @@ -10,7 +10,7 @@ # For Python 3 from urllib.parse import urlencode -USER_AGENT = 'quickchart-python (1.0.0)' +USER_AGENT = 'quickchart-python (2.0.0)' FUNCTION_DELIMITER_RE = re.compile('\"__BEGINFUNCTION__(.*?)__ENDFUNCTION__\"') From 166d54068f34cfbf1ccbfbd1df78b14069e4ae82 Mon Sep 17 00:00:00 2001 From: Ian Webster Date: Sat, 24 Sep 2022 15:43:03 -0700 Subject: [PATCH 4/4] Explain support python versions --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 24cb34f..972e4f5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # quickchart-python [![Build Status](https://travis-ci.com/typpo/quickchart-python.svg?branch=master)](https://travis-ci.com/typpo/quickchart-python) -![PyPI](https://img.shields.io/pypi/v/quickchart.io) -![PyPI - License](https://img.shields.io/pypi/l/quickchart.io) +[![PyPI](https://img.shields.io/pypi/v/quickchart.io)](https://pypi.org/project/quickchart-io/) +[![PyPI - License](https://img.shields.io/pypi/l/quickchart.io)](https://pypi.org/project/quickchart-io/) A Python client for the [quickchart.io](https://quickchart.io/) image charts web service. @@ -13,6 +13,8 @@ Use the `quickchart` library in this project, or install through [pip](https://p pip install quickchart.io ``` +As of release 2.0, this package requires >= Python 3.7. If you need support for earlier versions of Python, use [version 1.0.1](https://pypi.org/project/quickchart-io/1.0.1/). + # Usage This library provides a `QuickChart` class. Import and instantiate it. Then set properties on it and specify a [Chart.js](https://chartjs.org) config: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy