Miserlou / Miserlou/SoundScrape

Utilize rate limit information from error messages

Open
#203 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

major feature
Dominant language
Python
Stars
1.4k
Forks
143
PR merge metrics
No merged PRs in 30d

Description

~/Music $ soundscrape https://soundcloud.com/grrrreatdane/roll-in-peace-bootleg
Downloading: roll in peace (bootleg)
Problem downloading roll in peace (bootleg)
Traceback (most recent call last):
  File "/Users/rjones/anaconda/lib/python3.6/site-packages/soundscrape/soundscrape.py", line 437, in download_tracks
    stream = client.get(track['stream_url'], allow_redirects=False, limit=200)
  File "/Users/rjones/anaconda/lib/python3.6/site-packages/soundcloud/client.py", line 133, in _request
    return wrapped_resource(make_request(method, url, kwargs))
  File "/Users/rjones/anaconda/lib/python3.6/site-packages/soundcloud/request.py", line 148, in make_request
    result.raise_for_status()
  File "/Users/rjones/anaconda/lib/python3.6/site-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 429 Client Error: Unknown for url: https://api.soundcloud.com/tracks/377559152/stream?limit=200&client_id=175c043157ffae2c6d5fed16c3d95a4c

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/rjones/anaconda/bin/soundscrape", line 11, in <module>
    sys.exit(main())
  File "/Users/rjones/anaconda/lib/python3.6/site-packages/soundscrape/soundscrape.py", line 119, in main
    process_soundcloud(vargs)
  File "/Users/rjones/anaconda/lib/python3.6/site-packages/soundscrape/soundscrape.py", line 292, in process_soundcloud
    id3_extras=id3_extras)
  File "/Users/rjones/anaconda/lib/python3.6/site-packages/soundscrape/soundscrape.py", line 460, in download_tracks
    puts_safe(e)
  File "/Users/rjones/anaconda/lib/python3.6/site-packages/soundscrape/soundscrape.py", line 1315, in puts_safe
    puts(text)
  File "/Users/rjones/anaconda/lib/python3.6/site-packages/clint/textui/core.py", line 57, in puts
    s = tsplit(s, NEWLINES)
  File "/Users/rjones/anaconda/lib/python3.6/site-packages/clint/utils.py", line 69, in tsplit
    string = string.replace(i, final_delimiter)
AttributeError: 'HTTPError' object has no attribute 'replace'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in soundscrape.py at download_tracks around lines 437 and 460, then inspect puts_safe around line 1315 and the handling of the HTTP 429 error shown in the traceback. Determine how rate-limit information should be surfaced or used, and verify that the error no longer produces the secondary AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.