Renamed accounts #9
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces functionality to handle renamed Substack user accounts by following redirects, along with corresponding updates to the documentation, API, and tests. The main changes include the addition of redirect handling in the
Userclass, a new helper function for manual handle resolution, and updates to the user guide and API reference.New Features and Enhancements:
Redirect Handling in
UserClass:follow_redirectsparameter to theUserclass to enable automatic redirect handling for renamed Substack handles. [1] [2]was_redirectedproperty to check if a user's handle was redirected._update_handleto update the user's handle and endpoint after a redirect. [1] [2]Helper Function for Manual Handle Resolution:
resolve_handle_redirectto resolve renamed handles manually by following redirects. [1] [2]Documentation Updates:
API Reference Updates:
follow_redirectsparameter,was_redirectedproperty, and_update_handlemethod in theUserclass. [1] [2] [3]_fetch_user_data.User Guide Enhancements:
Userclass with and without redirect handling. [1] [2]Codebase Updates:
substack_api/__init__.py:resolve_handle_redirectin the module's public API.Improved Error Handling:
_fetch_user_datato handle 404 errors caused by renamed accounts and retry with the new handle iffollow_redirectsis enabled.