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' 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: 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/* diff --git a/setup.py b/setup.py index 300e786..3133edf 100644 --- a/setup.py +++ b/setup.py @@ -6,21 +6,21 @@ # Get the long description from the relevant file setup( - name='imgurpython', + name='gimgurpython', # 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