Reference¶
gyazo.Api class¶
-
class
gyazo.
Api
(client_id: Optional[str] = None, client_secret: Optional[str] = None, access_token: Optional[str] = None, api_url: str = 'https://api.gyazo.com', upload_url: str = 'https://upload.gyazo.com')¶ Bases:
object
A Python interface for Gyazo API
-
delete_image
(image_id: str) → gyazo.image.Image¶ Delete an image
- Parameters
image_id – Image ID
-
get_image
(image_id: str) → gyazo.image.Image¶ Get an image
- Parameters
image_id – Image ID
-
get_image_list
(page: int = 1, per_page: int = 20) → gyazo.image.ImageList¶ 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: str) → Dict[str, Any]¶ Return an oEmbed format json dictionary
- Parameters
url – Image page URL (ex. http://gyazo.com/xxxxx)
-
upload_image
(image_file: BinaryIO, referer_url: Optional[str] = None, title: Optional[str] = None, desc: Optional[str] = None, created_at: Optional[float] = None, collection_id: Optional[str] = None) → gyazo.image.Image¶ 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.Image class¶
-
class
gyazo.
Image
(**kwargs: Any)¶ Bases:
object
A class representing an image of Gyazo
-
created_at
= None¶ The time this image was created
-
download
() → Optional[bytes]¶ Download an image file if it exists
- Raises
-
download_thumb
() → Optional[bytes]¶ Download a thumbnail image file
- Raises
-
property
filename
¶ An image filename
- Getter
Return an image filename if it exists
-
static
from_dict
(data: Mapping[str, Any]) → gyazo.image.Image¶ Create a new instance from dict
- Parameters
data – A JSON dict
-
image_id
= None¶ An image ID
-
property
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
-
ocr
= None¶ Result of OCR
-
permalink_url
= None¶ A permalink URL
-
property
thumb_filename
¶ A thumbnail image filename
- Getter
Return a thumbnail filename
-
thumb_url
= None¶ A thumbnail URL
-
to_dict
() → Dict[str, Any]¶ Return a dict representation of this instance
-
to_json
(indent: Union[int, str, None] = None, sort_keys: bool = True) → str¶ Return a JSON string representation of this instance
- Parameters
indent – specify an indent level or a string used to indent each level
sort_keys – the output is sorted by key
-
type
= None¶ A type of the image
-
url
= None¶ An image URL
-
gyazo.ImageList class¶
-
class
gyazo.
ImageList
(**kwargs: Any)¶ Bases:
object
A class representing a list of gyazo.Image
-
current_page
= None¶ Current page number (1-index)
-
static
from_list
(data: Iterable[Mapping[str, Any]]) → gyazo.image.ImageList¶ Create a new instance from list
- Parameters
data – A JSON list
-
property
has_next_page
¶ Whether there is a next page or not
- Getter
Return true if there is a next page
-
property
has_previous_page
¶ Whether there is a previous page or not
- Getter
Return true if there is a previous page
-
images
= None¶ List of images
-
property
num_pages
¶ The number of pages
- Getter
Return the number of pages
-
per_page
= None¶ The number of images per page
-
set_attributes_from_headers
(headers: Mapping[str, str]) → None¶ Set instance attributes with HTTP header
- Parameters
headers – HTTP header
-
to_json
(indent: Union[int, str, None] = None, sort_keys: bool = True) → str¶ Return a JSON string representation of this instance
- Parameters
indent – specify an indent level or a string used to indent each level
sort_keys – the output of dictionaries is sorted by key
-
total_count
= None¶ The number of images
-
user_type
= None¶ User type
-