How to use the lyricsgenius.api.Genius function in lyricsgenius

To help you get started, we’ve selected a few lyricsgenius examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github johnwmillr / LyricsGenius / tests / test_genius.py View on Github external
import os
import unittest
from lyricsgenius.api import Genius
from lyricsgenius.song import Song
from lyricsgenius.artist import Artist
from lyricsgenius.utils import sanitize_filename


# Import client access token from environment variable
client_access_token = os.environ.get("GENIUS_CLIENT_ACCESS_TOKEN", None)
assert client_access_token is not None, "Must declare environment variable: GENIUS_CLIENT_ACCESS_TOKEN"
genius = Genius(client_access_token, sleep_time=0.5)


class TestEndpoints(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        print("\n---------------------\nSetting up Endpoint tests...\n")
        cls.search_term = "Ezra Furman"
        cls.song_title_only = "99 Problems"

    def test_search_genius_web(self):
        # TODO: test more than just a 200 response
        msg = "Response was None."
        r = genius.search_genius_web(self.search_term)
        self.assertTrue(r is not None, msg)

lyricsgenius

Download lyrics and metadata from Genius.com

MIT
Latest version published 4 years ago

Package Health Score

58 / 100
Full package analysis

Similar packages