Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

add upload_from_base64 method #86

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The best way to reach out to Imgur for API support is emailing us at [email protected]
Installation
------------

pip install imgurpython
pip install gimgurpython

Library Usage
------------
Expand All @@ -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'
Expand Down
12 changes: 12 additions & 0 deletions imgurpython/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions push-pypi.py
Original file line number Diff line number Diff line change
@@ -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/*
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='[email protected]',

# Choose your license
Expand Down