sandordargo / dev-to-analytics

Gives you insights on your articles on Dev.to
19 stars 2 forks source link

Check OK HTTP response and add User-Agent header #3

Closed MiguelMJ closed 2 years ago

MiguelMJ commented 2 years ago

I was trying to use this again but I was getting the same error when parsing the response. I soon realized that I was getting a 403 error and the code didn't check the response code before using it, so now it does.

I still get the 403 error (which is weird because I can use the API via curl, but not with this...) but now the program prints the response code before exiting.

MiguelMJ commented 2 years ago

As I thought, the error was being caused because the request didn't have a User-Agent header. I added one and it works fine now :)

sandordargo commented 2 years ago

Thank you for the fix!