abiczo / github-notifier

Github updates notifier for Linux
57 stars 8 forks source link

help users track down issues easier - would have helped #23 #25

Closed dotnetCarpenter closed 7 years ago

dotnetCarpenter commented 7 years ago

I agree with the author of feedparser, about not changing urls..

Repeatedly requesting the original address of a feed that has been permanently redirected is very rude, and may get you banned from the server.

Here is my verbose output after this patch:

[INFO] 10 May 03:29:27
github-notifier is capable of using hyperlinks
[INFO] 10 May 03:29:27
Creating system tray icon
[INFO] 10 May 03:29:27
Fetching feed http://github.com/dotnetCarpenter.private.atom?token=AACq88ajoAWbD5PMpBLJW4Smd8byV3Yyks63HikYwA==
[INFO] 10 May 03:29:27
Enabling feeds organizations
[ERROR] 10 May 03:29:31
Feed answered with 301 - Moved Permanently
[INFO] 10 May 03:29:31
Fetching feed http://github.com/dotnetCarpenter.private.actor.atom?token=AACq88ajoAWbD5PMpBLJW4Smd8byV3Yyks63HikYwA==
[ERROR] 10 May 03:29:32
Feed answered with 301 - Moved Permanently
[INFO] 10 May 03:29:32
Fetching feed https://github.com/organizations/IT-Kollektivet/dotnetCarpenter.private.atom?token=AACq88ajoAWbD5PMpBLJW4Smd8byV3Yyks63HikYwA==
[ERROR] 10 May 03:29:33
Feed answered with 401 - Unauthorized
[INFO] 10 May 03:29:33
Fetching feed https://github.com/organizations/Firefund/dotnetCarpenter.private.atom?token=AACq88ajoAWbD5PMpBLJW4Smd8byV3Yyks63HikYwA==
[ERROR] 10 May 03:29:33
Feed answered with 401 - Unauthorized
[INFO] 10 May 03:29:33
Fetching feed https://github.com/organizations/traitsjs/dotnetCarpenter.private.atom?token=AACq88ajoAWbD5PMpBLJW4Smd8byV3Yyks63HikYwA==
[ERROR] 10 May 03:29:34
Feed answered with 401 - Unauthorized
[INFO] 10 May 03:29:34
Found item entry
[INFO] 10 May 03:29:34
Found item entry
[INFO] 10 May 03:29:34
Found item entry

I'll see if I can find the correct URL's and update this PR.

The HTTP error codes are not complete - I only included the ones that I think could ever matter to a project like github-notifier. So there is more than enough but obviously not all.

abiczo commented 7 years ago

Great idea, thanks!

One question, I wonder if the list of error code descriptions is already available somewhere in the standard library? Quick googling turned up this: http://stackoverflow.com/questions/24718557/get-the-description-of-a-status-code-in-python-requests Could we use that instead of maintaining a custom list in the code?

dotnetCarpenter commented 7 years ago

Maintaining... maintaining.. I haven't seen http codes change in my 15 years as a developer but...

Seem that it's no problem getting the http descriptions but there is not way around checking the status code to see if it should be considered an error for github-notifier or it's irrelevant. But the list can be boiled down to 301, 4xx and 5xx. That would reduce the code a little bit.

dotnetCarpenter commented 7 years ago

@abiczo I removed the dictionary object and now use the descriptions from httplib. I also fixed the 301 permanent redirects (it was for http and not https calls) and added a better description (output the offensive URL) in case a 301, 4xx or 5xx status code is found.

What do you think?

abiczo commented 7 years ago

Looks great, thank you!