hummingbird package

Submodules

hummingbird.objects module

class hummingbird.objects.Anime(anime_dict)

Bases: builtins.object

Object to model the anime structure.

alternate_title = ''
anime_id = 0
cover_image = ''
episode_count = 0
genres = []
show_type = ''
slug = ''
status = ''
synopsis = ''
title = ''
url = ''
class hummingbird.objects.Favorite(fav_dict)

Bases: builtins.object

Object to model a favorite anime.

created_at = ''
fav_id = 0
fav_rank = 0
item_id = 0
item_type = ''
updated_at = ''
user_id = 0
class hummingbird.objects.LibraryEntry(entry_dict)

Bases: builtins.object

Object to model a library entry.

anime = None
entry_id = 0
episodes_watched = 0
last_watched = ''
notes = ''
notes_present = False
private = False
rating = None
rewatched_times = 0
rewatching = False
status = ''
class hummingbird.objects.LibraryEntryRating(rating_dict)

Bases: builtins.object

Object to model a library entry rating.

rating_type = ''
value = ''
class hummingbird.objects.MiniUser(user_dict)

Bases: builtins.object

Object to model a user.

avatar = ''
avatar_small = ''
name = ''
nb = False
url = ''
class hummingbird.objects.Story(story_dict)

Bases: builtins.object

Object to model a story.

media = None
poster = None
self_post = False
story_id = 0
story_type = ''
substories = []
substories_count = 0
updated_at = ''
user = None
class hummingbird.objects.Substory(story_dict)

Bases: builtins.object

Object to model a substory.

comment = ''
created_at = ''
episode_number = 0
followed_user = None
new_status = ''
permissions = {}
service = None
substory_id = 0
substory_type = ''
class hummingbird.objects.User(user_dict)

Bases: builtins.object

Object to model a user.

about = ''
avatar = ''
bio = ''
cover_image = ''
favorites = []
following = ''
karma = ''
last_library_update = ''
life_spent_on_anime = ''
location = ''
name = ''
online = False
show_adult_content = False
title_language_preference = ''
waifu = ''
waifu_char_id = ''
waifu_or_husbando = ''
waifu_slug = ''
website = ''

Module contents

class hummingbird.Hummingbird(username, password)

Bases: builtins.object

Object for the wrapper for the Hummingbird API v1

_query_(path, method, params={})

Used internally for requests.

Parameters:
  • path (str) – The path to hit.
  • method (str) – The method to use, either ‘GET’ or ‘POST.
  • data (dict) – The optional paramters to the GET or the data to POST.
Returns:

Requests object – Requires you to handle the status codes yourself.

api_url = 'http://hummingbird.me/api/v1'
auth_token = ''
authenticate(username, password)

Authenticates your user and returns an auth token.

Parameters:
  • username (str) – Hummingbird username.
  • password (str) – Hummingbird password.
Returns:

str – The Auth Token

Raises:

ValueError – If the Authentication is wrong

get_anime(anime_id, title_language='canonical')

Fetches the Anime Object of the given id or slug.

Parameters:
  • anime_id (int or str) – The Anime ID or Slug.
  • title_language (str) – The PREFERED title language can be any of ‘canonical’, ‘english’, ‘romanized’
Returns:

Anime Object – The Anime you requested.

get_library(username, status=None)

Fetches a users library.

Parameters:
  • username (str) – The user to get the library from.
  • status (str) – only return the items with the supplied status. Can be one of currently-watching, plan-to-watch, completed, on-hold or dropped.
Returns:

List of Library objects.

headers = {'content-type': 'application/json'}
search_anime(query)

Fuzzy searches the Anime Database for the query.

Parameters:query (str) – The text to fuzzy search.
Returns:List of Anime Objects. This list can be empty.
update_entry(anime_id, status=None, privacy=None, rating=None, sane_rating_update=None, rewatched_times=None, notes=None, episodes_watched=None, increment_episodes=None)

Creates or updates the Library entry with the provided values.

Parameters:
  • anime_id (int or str) – The Anime ID or Slug.
  • auth_token (str) – User authentication token.
  • status (str) – Can be one of ‘currently-watching’, ‘plan-to-watch’, ‘completed’, ‘on-hold’, ‘dropped’.
  • privacy (str) – Can be one of ‘public’, ‘private’. Making an entry private will hide it from public view.
  • rating (str, int or float) – Can be one of 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5. Setting it to the current value or 0 will remove the rating.
  • sane_rating_update (str, int or float) – Can be any one of the values for rating. Setting it to 0 will remove the rating. This should be used instead of rating if you don’t want to unset the rating when setting it to its current value.
  • rewatched_times (int) – Number of rewatches. Can be 0 or above.
  • notes (str) – The personal notes for the entry.
  • episodes_watched (int) – Number of watched episodes. Can be between 0 and the total number of episodes. If equal to total number of episodes, status should be set to completed.
  • increment_episodes (bool) – If set to true, increments watched episodes by one. If used along with episodes_watched, provided value will be incremented.
Raises:

ValueError – if Authentication Token is invalid (it shouldn’t be), or if there is a 500 Internal Server Error or if the response is Invalid JSON Object.