Reference

gyazo.Api class

class gyazo.Api(client_id=None, client_secret=None, access_token=None, api_url=u'https://api.gyazo.com', upload_url=u'https://upload.gyazo.com')

Bases: object

A Python interface for Gyazo API

delete_image(image_id)

Delete an image

Parameters:image_id – Image ID
get_image_list(page=1, per_page=20)

Return a list of user’s saved images

Parameters:
  • page – (optional) Page number (default: 1)
  • per_page – (optional) Number of images per page (default: 20, min: 1, max: 100)
get_oembed(url)

Return an oEmbed format json dictionary

Parameters:url – Image page URL (ex. http://gyazo.com/xxxxx)
upload_image(image_file, referer_url=None, title=None, desc=None, created_at=None, collection_id=None)

Upload an image

Parameters:
  • image_file – File-like object of an image file
  • referer_url – Referer site URL
  • title – Site title
  • desc – Comment
  • created_at – Image’s created time in unix time
  • collection_id – Collection ID

gyazo.GyazoError class

class gyazo.GyazoError

Bases: exceptions.Exception

Base class for Gyazo errors

gyazo.Image class

class gyazo.Image(**kwargs)

Bases: object

A class representing an image of Gyazo

download()

Download an image file

Return type:bytes | str
Raises:GyazoError
download_thumb()

Download a thumbnail image file

Return type:bytes | str
Raises:GyazoError
filename

An image filename

Getter:Return an image filename if it exists
Return type:str | unicode
static from_dict(data)

Create a new instance from dict

Parameters:data – A JSON dict
local_created_at

The time this image was created in local time zone

Getter:Return the time this image was created in local time zone if it exists
thumb_filename

A thumbnail image filename

Getter:Return a thumbnail filename if it exists
Return type:str | unicode
to_dict()

Return a dict representation of this instance

to_json(indent=None, sort_keys=True)

Return a JSON string representation of this instance

Parameters:
  • indent (int | str) – specify an indent level or a string used to indent each level
  • sort_keys (bool) – the output is sorted by key
Return type:

str | unicode

gyazo.ImageList class

class gyazo.ImageList(**kwargs)

Bases: object

A class representing a list of gyazo.Image

static from_list(data)

Create a new instance from list

Parameters:data – A JSON list
has_next_page()

Whether there is a next page or not

Getter:Return true if there is a next page
has_previous_page()

Whether there is a previous page or not

Getter:Return true if there is a previous page
num_pages

The number of pages

Getter:Return the number of pages
Return type:int
set_attributes_from_headers(headers)

Set instance attributes with HTTP header

Parameters:headers (dict) – HTTP header
to_json(indent=None, sort_keys=True)

Return a JSON string representation of this instance

Parameters:
  • indent (int | str) – specify an indent level or a string used to indent each level
  • sort_keys (bool) – the output of dictionaries is sorted by key
Return type:

str | unicode