Skip to content

reconfigured types and added album, added retries and etc#162

Merged
johnwmillr merged 59 commits into
johnwmillr:masterfrom
allerter:tokenless
Nov 6, 2020
Merged

reconfigured types and added album, added retries and etc#162
johnwmillr merged 59 commits into
johnwmillr:masterfrom
allerter:tokenless

Conversation

@allerter
Copy link
Copy Markdown
Contributor

@allerter allerter commented Sep 29, 2020

  • moved tests to separate files
  • moved Artist and Song to types
  • added Album type and search_album method
  • reconfigured types and created BaseEntity
  • search_song now accepts song_id
  • added retries Geniu.retries for Timeout and HTTPErrors with a >= 500 status code.
  • updated docs

moved Artist and Song to types
added TokenRequiredError
updated docs,
Comment thread lyricsgenius/api/api.py Outdated
Comment thread lyricsgenius/api/base.py
Copy link
Copy Markdown
Owner

@johnwmillr johnwmillr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@allerter, thank you for these changes!

How many methods do we have overlapping between the developer API and the public, token-less API? Whenever there is overlap, I would prefer that we fall back to the developer API and require a token. I want to encourage as much authenticated use of the Genius API as possible.

Comment thread lyricsgenius/api/base.py
added public_api to methods (incomplete)
added the public_api attr to Genius,
removed pytest from dependencies
update TokenRequiredError,
update overlapping methods
@allerter

This comment has been minimized.

@allerter

This comment has been minimized.

This reverts commit 3386282644198706639e858098af18b560976ccd.
updated search_song,
updated genius.py imports
Comment thread lyricsgenius/genius.py
Comment thread tests/test_utils.py

def tearDown():
@classmethod
def tearDownClass(cls):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since TestUtils, is the last test to run, this method will close the session and we no longer will get the unclosed-socket warnings. But there's still a problem.
I ran the tests for 2.0.0 and in the end, only got one warning. But at the end of the tests for the current version, there are two warnings. This might mean that we are opening two sockets which is unnecessary. At the same time, genius._session.close() makes both of the warnings go away which is curious.

added artist to Song.to_dict
- added Song.lyrics defaulting to "" if lyrics amounts to False (when None is passed)
- added printing a more descriptive message when lyrics section isn't found,
- fixed a snippet
This was linked to issues Oct 31, 2020
@allerter
Copy link
Copy Markdown
Contributor Author

Hi, @johnwmillr. Please review this when you get a chance.

@johnwmillr
Copy link
Copy Markdown
Owner

Hi, @allerter. It's been a busy few weeks for me, but I do plan to review this PR. Thanks for your work on it! I'll get to work reviewing it this week.

reconfigured Genius.lyrics() to:
    * fetch the page through the Sender
    * extract the lyrics not only more concisely, but also without changing the original format of the lyrics (adding newlines)
* reconfigured Sender to:
    * allow making requests to Genius at https://genius.com
    * remove SLEEP_TIME to allow users to supply their own rate limiting (by default 0.2) instead of enforcing it
    * move the authorization header to the authorization_header attribute instead of re-creating it for every API call
@allerter allerter linked an issue Nov 2, 2020 that may be closed by this pull request
allerter and others added 9 commits November 3, 2020 11:09
    * to check lyrics_state along with the title
* reconfigured search_* that return an object:
    * to check lyrics_state to avoid getting empty lyrics
* moved setting excluded_terms to __init__
* moved _clean_str to utils and renamed to clean_str
* added tests for genius.tag
* reordered some of the imports and the functions alphabetically
- fix genius.tag() example
Copy link
Copy Markdown
Owner

@johnwmillr johnwmillr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work on this extensive PR, @allerter. I made a couple fixes to typos and pointed out two tests that are failing in my local environment. Once we sort that out it should be good to go.

Comment thread lyricsgenius/types/base.py
Comment thread tests/test_api.py
Comment thread tests/test_api.py Outdated
* added text_format parameter to account()
* added try/finally close to test_manage_annotation to try to delete created annotation if an exception occurs
@allerter allerter linked an issue Nov 6, 2020 that may be closed by this pull request
Copy link
Copy Markdown
Owner

@johnwmillr johnwmillr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests are passing for me. Thanks, @allerter!

@johnwmillr johnwmillr merged commit f9c08ba into johnwmillr:master Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants