From a329706585b09aa2195cc82cae84aec5479ce1de Mon Sep 17 00:00:00 2001 From: Robert Morris Date: Wed, 4 Jun 2014 10:37:32 -0400 Subject: [PATCH 1/3] tweak parse_html to return unmarked up text, add related test --- camo.py | 4 +++- tests/camo_test.py | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/camo.py b/camo.py index 53940c1..97dd02e 100644 --- a/camo.py +++ b/camo.py @@ -30,7 +30,9 @@ def _rewrite_image_urls(self, node): def parse_html(self, string): doc = html.fromstring(string.join(['
', '
'])) doc = self._rewrite_image_urls(doc) - return ''.join(map(html.tostring, doc)) + # iterating over a node returns all the tags within that node + # ..if there are none, return the original string + return ''.join(map(html.tostring, doc)) or string class Image(object): diff --git a/tests/camo_test.py b/tests/camo_test.py index 8bfdffc..d075dc1 100644 --- a/tests/camo_test.py +++ b/tests/camo_test.py @@ -39,3 +39,8 @@ def test_ignores_relative(self): client = CamoClient("https://fakecdn.org/", key="hello") html = """

""" self.assertEqual(client.parse_html(html), html) + + def test_unmarkedup_text(self): + client = CamoClient("https://fakecdn.org/", key="hello") + text = """butts""" + self.assertEqual(client.parse_html(text), text) From 4c2164159fd00b2be30190656dedee2b03cb0119 Mon Sep 17 00:00:00 2001 From: Michael Overmeyer Date: Sun, 4 Mar 2018 20:39:10 +0000 Subject: [PATCH 2/3] Switched broken pypip.in badges to shields.io --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ae4adb3..33a3e45 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Camo Client =========== [![Build Status](https://travis-ci.org/sionide21/camo-client.png)](https://travis-ci.org/sionide21/camo-client) -[![Latest Version](https://pypip.in/v/camo-client/badge.png)](https://pypi.python.org/pypi/camo-client/) +[![Latest Version](https://img.shields.io/pypi/v/camo-client.svg)](https://pypi.python.org/pypi/camo-client/) A python client for Github's [Camo image proxy](https://github.com/atmos/camo). From c2662b5cff940b12b3a967203222055d803e4807 Mon Sep 17 00:00:00 2001 From: Vince Veselosky Date: Thu, 10 Feb 2022 10:01:37 -0500 Subject: [PATCH 3/3] Add Github actions, modernize build system --- .github/workflows/release.yml | 36 +++++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 22 +++++++++++++++++++++ pyproject.toml | 6 ++++++ setup.py | 2 +- tox.ini | 11 +++++++++++ 5 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/tests.yml create mode 100644 pyproject.toml create mode 100644 tox.ini diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..458c50c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release + +on: + push: + tags: + - "*" + +jobs: + release: + runs-on: ubuntu-18.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install build packages + run: python -m pip install -U build + - name: Build packages + run: python -m build + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: | + dist/*.tar.gz + dist/*.whl + - name: Install system pkgs + run: sudo apt-get update && sudo apt-get install awscli + - name: Upload to S3 + env: + AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} + AWS_PACKAGE_BUCKET: ${{ secrets.AWS_PACKAGE_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + run: for F in dist/*; do /usr/bin/aws s3 cp ${F} s3://${AWS_PACKAGE_BUCKET}/python/ ; done diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..b1643b6 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,22 @@ +name: Run Tests + +on: [push, pull_request] + +jobs: + test: + strategy: + matrix: + python: ['3.6', '3.8'] + platform: [ubuntu-18.04] + runs-on: ${{ matrix.platform }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Install test dependencies + run: python -m pip install -U tox pytest + - name: Test + run: python -m tox -e py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..374b58c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "setuptools>=42", + "wheel" +] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 96d7bfe..49f3548 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name='camo-client', - version='0.2.1', + version='0.3.0', author='Ben Olive', author_email='sionide21@gmail.com', description="A python client for Github's Camo image proxy", diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..4086b4a --- /dev/null +++ b/tox.ini @@ -0,0 +1,11 @@ +[tox] +envlist = py36, py38 +isolated_build = True + +[testenv] + +deps = + pytest + +commands = + python -m pytest