Skip to content

Commit

Permalink
Using imgur API library
Browse files Browse the repository at this point in the history
  • Loading branch information
hyades committed May 3, 2015
1 parent 267ea08 commit 18a1e02
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .travis-setup.sh
Expand Up @@ -22,6 +22,8 @@ sudo pip3 install --upgrade -r requirements.txt

# Needed for tests
sudo apt-get -y install wget libav-tools
sudo pip install imgurpython
sudo pip3 install imgurpython

# Needed for style checks
sudo apt-get -y install indent
Expand Down
19 changes: 13 additions & 6 deletions python-api/tests/integrationtests2/baseclass.py
Expand Up @@ -307,12 +307,19 @@ def save_images(self, basename, img, expected, diff):

def upload_image(self, filename):
""" upload the specified image to imgurl"""
self.log.debug("calling imgurbash.sh %s", filename)
print(subprocess.check_output([
'bash',
'./imgurbash.sh',
filename
], timeout=5))
from imgurpython import ImgurClient
self.log.debug('Uploading file to imgur: {0}'.format(filename))
imgur_url = 'http://imgur.com/api/upload.xml'
client_id = '2a82340573d25b4'
client_secret = '19add6dbc4a411433b084beb57873895a0ec4a1d'
client = ImgurClient(client_id, client_secret)
try:

response = upload_from_path(filename, config=None, anon=True)
self.log.debug(response)
except:
self.log.warn("Upload failed")



class IntegrationTestbaseVideo(IntegrationTestbaseCompare):
Expand Down

0 comments on commit 18a1e02

Please sign in to comment.