From bb737b186a0328600725035633fb8f09a981596a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20MOLVEAU?= Date: Mon, 18 Sep 2017 23:55:04 +0200 Subject: [PATCH 1/5] add base64 upload --- imgurpython/client.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/imgurpython/client.py b/imgurpython/client.py index 9c41ea6..9f2d6ea 100644 --- a/imgurpython/client.py +++ b/imgurpython/client.py @@ -596,6 +596,18 @@ def upload(self, fd, config=None, anon=True): data.update({meta: config[meta] for meta in set(self.allowed_image_fields).intersection(config.keys())}) return self.make_request('POST', 'upload', data, anon) + + def upload_from_base64(self, b64, config=None, anon=True): + if not config: + config = dict() + + data = { + 'image': b64, + 'type': 'base64', + } + data.update({meta: config[meta] for meta in set(self.allowed_image_fields).intersection(config.keys())}) + + return self.make_request('POST', 'upload', data, anon) def upload_from_url(self, url, config=None, anon=True): if not config: From 96e3628d5d463a4fffd21457bad82cf9c6fd843f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20MOLVEAU?= Date: Tue, 19 Sep 2017 00:12:40 +0200 Subject: [PATCH 2/5] Update setup.py --- setup.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 300e786..30a9826 100644 --- a/setup.py +++ b/setup.py @@ -6,21 +6,21 @@ # Get the long description from the relevant file setup( - name='imgurpython', + name='g_imgurpython', # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # http://packaging.python.org/en/latest/tutorial.html#version - version='1.1.7', + version='0.0.1', - description='Official Imgur python library with OAuth2 and samples', + description='A fork of Official Imgur python library with OAuth2 and samples, modified as it seems not maintained anymore', long_description='', # The project's main homepage. - url='https://github.com/Imgur/imgurpython', + url='https://github.com/gmolveau/imgurpython', # Author details - author='Imgur Inc.', + author='Imgur Inc. (+ gmolveau)', author_email='api@imgur.com', # Choose your license From 5f1aeac0b8b5a9c410a060b44bc916918937c14a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20MOLVEAU?= Date: Tue, 19 Sep 2017 00:40:19 +0200 Subject: [PATCH 3/5] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 30a9826..3133edf 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ # Get the long description from the relevant file setup( - name='g_imgurpython', + name='gimgurpython', # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see From 3c4887a2827a15f3747b870a4763a9e457fd3c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20MOLVEAU?= Date: Tue, 19 Sep 2017 00:40:55 +0200 Subject: [PATCH 4/5] Create push-pypi.py --- push-pypi.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 push-pypi.py diff --git a/push-pypi.py b/push-pypi.py new file mode 100644 index 0000000..768096d --- /dev/null +++ b/push-pypi.py @@ -0,0 +1,4 @@ +#!/bin/bash +rm -rf build; +rm -rf dist; +python3 setup.py sdist && python3 setup.py bdist_wheel --universal && twine upload dist/* From f6bfddb43f7b6fd4d94245d67a90a1b8013e27db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20MOLVEAU?= Date: Tue, 19 Sep 2017 00:41:41 +0200 Subject: [PATCH 5/5] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 999a987..7d9f5df 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ The best way to reach out to Imgur for API support is emailing us at api@imgur.c Installation ------------ - pip install imgurpython + pip install gimgurpython Library Usage ------------ @@ -38,7 +38,7 @@ To use the client from a strictly anonymous context (no actions on behalf of a u ```python -from imgurpython import ImgurClient +from gimgurpython import ImgurClient client_id = 'YOUR CLIENT ID' client_secret = 'YOUR CLIENT SECRET'