Skip to content

Commit

Permalink
Merge pull request #11 from ymyzk/develop
Browse files Browse the repository at this point in the history
0.7.0
  • Loading branch information
ymyzk committed Feb 2, 2015
2 parents e2077df + 3df2ba9 commit 940c032
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# python-gyazo
[![PyPI version](https://badge.fury.io/py/python-gyazo.svg)](http://badge.fury.io/py/python-gyazo)
[![Build Status](https://travis-ci.org/ymyzk/python-gyazo.svg?branch=master)](https://travis-ci.org/ymyzk/python-gyazo)
[![Coverage Status](https://img.shields.io/coveralls/ymyzk/python-gyazo.svg)](https://coveralls.io/r/ymyzk/python-gyazo?branch=master)
[![Coverage Status](https://coveralls.io/repos/ymyzk/python-gyazo/badge.svg?branch=master)](https://coveralls.io/r/ymyzk/python-gyazo?branch=master)

A Python wrapper for Gyazo API.

Expand Down Expand Up @@ -44,6 +44,10 @@ with open('sample.png', 'rb') as f:

### Delete image
api.delete_image('IMAGE_ID')

### oEmbed
image = images[0]
print(api.get_oembed(image.permalink_url))
```

## Backup
Expand Down
15 changes: 15 additions & 0 deletions gyazo/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,21 @@ def delete_image(self, image_id):
headers, result = self._parse_and_check(response)
return Image.from_dict(result)

def get_oembed(self, url):
"""Return an oEmbed format json dictionary
:param url: Image page URL (ex. http://gyazo.com/xxxxx)
:type url: str or unicode
:rtype: dict
"""
api_url = self.api_url + '/api/oembed'
parameters = {
'url': url
}
response = self._request_url(api_url, 'get', parameters)
headers, result = self._parse_and_check(response)
return result

def _request_url(self, url, method, data=None, files=None,
with_client_id=False, with_access_token=False):
"""Send HTTP request
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


__author__ = 'Yusuke Miyazaki <miyazaki.dev@gmail.com>'
__version__ = '0.6.2'
__version__ = '0.7.0'

requires = [
'Jinja2>=2.7.0',
Expand Down Expand Up @@ -46,6 +46,7 @@
author=__author__,
author_email='miyazaki.dev@gmail.com',
url='https://github.com/ymyzk/python-gyazo',
license='MIT',
packages=['gyazo'],
package_data={'gyazo': ['themes/default/*']},
scripts=['scripts/gyazo-backup'],
Expand Down

0 comments on commit 940c032

Please sign in to comment.