Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.0 #171

Merged
merged 45 commits into from
Feb 9, 2021
Merged

v3.0 #171

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3a5d852
Added vcr support for consistent tests
ludehon Sep 1, 2019
37bcd08
Merge branch 'master' into pr/109
allerter Nov 8, 2020
69dc4c3
added vcr to tests
allerter Nov 8, 2020
92a3d69
changed displaying types attributes as table in docs
allerter Nov 8, 2020
92816fd
add vcrpy to requirements
allerter Nov 8, 2020
33f096c
test tox.ini
allerter Nov 8, 2020
cfe657e
Revert "test tox.ini"
allerter Nov 8, 2020
99bf009
removed except in tests
allerter Nov 9, 2020
1d9f297
merge pr/109 into docs
allerter Nov 9, 2020
c1221ae
merge pr/109 into docs
allerter Nov 10, 2020
b77c6d1
- added checking for the instrumental attribute in song info
allerter Nov 10, 2020
5cb1668
added instrumental attribute to types.Song
allerter Nov 10, 2020
58cd38f
Revert "merge pr/109 into docs"
allerter Nov 10, 2020
0471eb9
add Song.instrumental to docs
allerter Nov 10, 2020
2d1f63c
- add instrumental to to_dict
allerter Nov 10, 2020
0ba9c74
set retries to 3
allerter Nov 10, 2020
e131b0d
- Genius: removed checking instrumental in search_artist (genius.arti…
allerter Nov 11, 2020
50e883d
add some description for charts
allerter Nov 11, 2020
f2ab716
remove Song.instrumental references
allerter Nov 11, 2020
1c39376
added raising TypeError when no token/empty token is passed
allerter Nov 12, 2020
bf8c076
- renamed album.songs to album.tracks
allerter Nov 21, 2020
9b72d56
added importing Track from types
allerter Nov 21, 2020
db0c3b3
- fixed issues in Track
allerter Nov 21, 2020
b84221d
- reconfigured get_user_token to accept code and state parameters
allerter Nov 28, 2020
2376a58
- updated get_user_token docstring
allerter Nov 28, 2020
4573de5
- removed test_get_user_token_client_flow as its unnecessary
allerter Nov 28, 2020
65b2980
- refactored get_user_token to allow use by token flow
allerter Dec 7, 2020
402eaf5
removed redundant requirements.txt file
allerter Dec 7, 2020
609b1bb
fixed tests issue
allerter Dec 7, 2020
bcf14f7
- added page_data endpoint to PublicAPI
allerter Dec 9, 2020
df213e3
handle instance where error response might not be json
allerter Jan 17, 2021
c0ad3eb
added test for page_data
allerter Jan 19, 2021
0385abd
fix typo in artist ID in example and test
allerter Jan 19, 2021
8cf520d
fixed TypeError when instantiating PublicAPI directly with no token p…
allerter Jan 19, 2021
7cc60e6
use built-in class name to define public api constructor
allerter Jan 19, 2021
838cc21
genius.lyrics: broke down urlthing parameter into song_url and song_id
allerter Jan 27, 2021
c51cb8b
added non-breaking space to punctuation words
allerter Jan 28, 2021
08691ca
linked to the snippets page in the usage page
allerter Feb 6, 2021
0cf0b3d
Revert "add vcrpy to requirements"
allerter Feb 7, 2021
468a806
Revert adding vcrpy to tests
allerter Feb 7, 2021
96bb0c6
Remove VCR from test_base.py
johnwmillr Feb 7, 2021
0c59c09
Remove VCR from test_genius.py and test_public_methods.py
allerter Feb 7, 2021
184432f
Update version to 3.0.0
johnwmillr Feb 7, 2021
4c7f312
added release notes for 3.0.0
allerter Feb 8, 2021
ab719c0
Set release date to 2021-02-08
johnwmillr Feb 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lyricsgenius/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,17 @@ def __init__(
retries=0,
**kwargs
):

# If PublicAPI was instantiated directly
# there is no need for a token anymore
public_api_constructor = False if 'Genius' in str(self) else True
allerter marked this conversation as resolved.
Show resolved Hide resolved

# Genius PublicAPI Constructor
super().__init__(
response_format=response_format,
timeout=timeout,
sleep_time=sleep_time,
retries=retries,
public_api_constructor=public_api_constructor,
**kwargs
)
14 changes: 9 additions & 5 deletions lyricsgenius/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def __init__(
response_format='plain',
timeout=5,
sleep_time=0.2,
retries=0
retries=0,
public_api_constructor=False,
):
self._session = requests.Session()
self._session.headers = {
Expand All @@ -29,11 +30,14 @@ def __init__(
if access_token is None:
access_token = os.environ.get('GENIUS_ACCESS_TOKEN')

if not access_token or not isinstance(access_token, str):
raise TypeError('Invalid token')
if public_api_constructor:
self.authorization_header = {}
else:
if not access_token or not isinstance(access_token, str):
raise TypeError('Invalid token')
self.access_token = 'Bearer ' + access_token
self.authorization_header = {'authorization': self.access_token}

self.access_token = 'Bearer ' + access_token
self.authorization_header = {'authorization': self.access_token}
self.response_format = response_format.lower()
self.timeout = timeout
self.sleep_time = sleep_time
Expand Down
2 changes: 1 addition & 1 deletion lyricsgenius/api/public_methods/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def page_data(self, album=None, song=None, artist=None):
page_type = 'songs'

# item path becomes something like: Artist/Song
item_path = song.replace(artist, artist + '/').replace('-lyrics', '')
item_path = song[1:].replace(artist + '-', artist + '/').replace('-lyrics', '')

page_path = '/{page_type}/{item_path}'.format(page_type=page_type,
item_path=item_path)
Expand Down