question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Genius class should automatically check for token environment variable

See original GitHub issue

Is your feature request related to a problem? Please describe. No problem, it’s just a hassle to retrieve your client access token from os each time you use lyricsgenius.

Describe the solution you’d like If the user doesn’t pass a user token to Genius, the class should check the OS environment variables for GENIUS_ACCESS_TOKEN.

Describe alternatives you’ve considered There are no alternatives.

Additional context Probably here is where you’d modify the code.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
allertercommented, Oct 20, 2020

The only case that could lead to confusion is that if the user passes no token, but has an invalid token in their env var, and then tries to use an endpoint using the developers API. Should we print a message in that case? Something like this:

if token is None:
    token = os.environ.get("GENIUS_ACCESS_TOKEN")
    if token is not None:
        print("Token was obtained from environment variables.")
self.access_token = token
0reactions
allertercommented, Oct 21, 2020

It’s probably better for the package to rely on the API as much as possible as you said. And since the token-less branch is complete, I’ll just leave it on my fork. I’ll update #162 soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

geniusr: the basics - Ewenme
Pass your access token to a GENIUS_API_TOKEN environment variable by explicitly calling the genius_token() function, or when prompted by other functions. Once ...
Read more >
Set Bearer Token as Environment Variable in Postman for All ...
Once you set up everything properly click on send button. Then you will be able to see the token value is properly store...
Read more >
Environment variables containing newlines in Node?
It must be that your PRIVATE_KEY variable doesn't contain actual newlines, but \n literals (a \ char. followed by char. n ). If...
Read more >
Spring Boot Token based Authentication with Spring Security ...
Tables that we define in models package will be automatically generated in Database. If you check MySQL database for example, you can see...
Read more >
How to Collect Song Lyrics with Python | by emakpati
We'll first start by importing lyricsgenius. import lyricsgenius as lg. We also need to create a variable for the path to the file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found