Skip to content

Instantly share code, notes, and snippets.

@tomaarsen
Last active September 8, 2019 09:40
Show Gist options
  • Save tomaarsen/1239943f4dc730a423d474c22456acf7 to your computer and use it in GitHub Desktop.
Save tomaarsen/1239943f4dc730a423d474c22456acf7 to your computer and use it in GitHub Desktop.
Python The Noun Project API Wrapper example
# See the Documentation for more information: https://cubiedev.github.io/TheNounProjectAPI
# Install Module using "pip install TheNounProjectAPI".
# This sample works for version >= 1.0.5
from TheNounProjectAPI import API
if __name__ == "__main__":
# API Key and Secret from https://api.thenounproject.com/getting_started.html#creating-an-api-key
key = "<my api key>"
secret = "<my api secret>"
# Create api object
api = API(key=key, secret=secret)
# See the documentation for more endpoints
icon = api.get_icon("goat")
# >>>icon
# <IconModel: Term: Goat, Slug: goat, Id: 8786>
print("Icon's term:", icon.term)
print("This icon's tags:", ", ".join(tag.slug for tag in icon.tags))
print("Uploader's username:", icon.uploader.username)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment