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

[YOURLS] Bump yourls-python to 1.2.3 #642

Merged
merged 1 commit into from
Apr 16, 2023

Conversation

Injabie3
Copy link
Member

@Injabie3 Injabie3 commented Apr 16, 2023

Description of the changes

This PR fixes an issue where the [p]yourls stats command would error out. The root cause is in the call to YOURLS' stats method: when the limit value is more than the number of shorten URLs, it would raise a KeyError. This call is made by cmdStats in cog yourlsClient (which basically means [p]yourls stats) which always specifies a limit of 3.

This resolves #641 .

Have the changes in this PR been tested?

Yes

Testing

  • Before
    image
[17:20:28] ERROR    [red] Exception in command 'yourls stats'
╭─ Traceback (most recent call last)
<truncated>
│ /home/xxx/git/Ren/v3-data/cogs/Downloader/lib/yourls/core.py:162 in stats
│ ❱ 162                 links.append(_json_to_shortened_url(jsondata['links'][key]))
KeyError: 'link_2'
  • After
    image

@Injabie3 Injabie3 requested a review from a team April 16, 2023 00:53
Copy link
Member

@quachtridat quachtridat left a comment

Choose a reason for hiding this comment

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

Changes LGTM.

In the PR description, Can you add a small detail saying the limit value within stats method invocation is (always) 3? We do 3 for the cog but the shortener itself also has stats method as a part of its API so some details can be appended too. Something like:

-This PR fixes an issue where the `[p]yourls stats` command would error out. The root cause is in the call to the `stats` method: when the `limit` value is more than the number of shorten URLs, it would raise a `KeyError`.
+This PR fixes an issue where the `[p]yourls stats` command would error out. The root cause is in the call to YOURLS' `stats` method: when the `limit` value is more than the number of shorten URLs, it would raise a `KeyError`. This call is made by `cmdStats` in cog `yourlsClient` (which basically means `[p]yourls stats`) which always specifies a `limit` of 3 hence #641.

This fixes an issue where the `[p]yourls stats` command would error
out. The root cause is in the call to YOURLS' `stats` method: when
the `limit` value is more than the number of shorten URLs, it would
raise a `KeyError`. This call is made by `cmdStats` (executed as part
of the `[p]yourls stats` command) which always specifies a `limit` of
3.
@Injabie3
Copy link
Member Author

In the PR description, Can you add ...

Fixed and amended commit message to do the same. Force-pushed.

@Injabie3 Injabie3 merged commit e5de92d into SFUAnime:V3/testing Apr 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[YOURLS] [p]yourls stats fails if there are < 3 URLs
2 participants