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

HTTP Error 401: Unauthorized getting https://api.tumblr.com/ #210

Closed
jorong1 opened this issue Jun 20, 2020 · 13 comments
Closed

HTTP Error 401: Unauthorized getting https://api.tumblr.com/ #210

jorong1 opened this issue Jun 20, 2020 · 13 comments

Comments

@jorong1
Copy link

jorong1 commented Jun 20, 2020

tumblr-utils 08cbe44
Command:
./bin/python2.7 tumblr_backup.py --incremental --save-video --save-audio --json $BLOG

Output:

HTTP Error 401: Unauthorized getting https://api.tumblr.com/v2/blog/$BLOG.tumblr.com/posts?reblog_info=true&api_key=brVeh51SIEuLgQIJqRwmJYJMNdXHSvk0R3GiN0ETcaDYrEqH1B&limit=1

Expected output:
Posts successfully being backed up

This happens on any blog, any post. Confirmed the blogs are not private, do exist, and don't require you to be logged in to Tumblr to view.
Is this because the API key was update recently and it's hit the 5000 API call limit, before Tumblr has approved limit removal?

Also begs the question, if I use my own app and API key can I avoid this error?
Thanks

@ghost
Copy link

ghost commented Jun 20, 2020

I've got the same issue. I already had it yesterday, then downloaded the recently updated tumblr_backup.py with the new API key and everything worked, but apparently Tumblr has changed something between yesterday and today...

@bbolli
Copy link
Owner

bbolli commented Jun 21, 2020

I didn't apply for any rate limitation. But if this goes on, I'll have to remove the API key and you mass-downloaders will have to get your own keys :-)

@daggerfang1
Copy link

I didn't apply for any rate limitation. But if this goes on, I'll have to remove the API key and you mass-downloaders will have to get your own keys :-)

I'm having the same issue. My last attempt before today was April 29 and there was no problem. Now I can't do anything.

I'm willing to get my own API key - how do I do that? I looked at my account settings on tumblr and it isn't obvious where to get one. And once I do that, do I just replace the key currently in your .py file with the new one?

@ghost
Copy link

ghost commented Jun 22, 2020

I'm willing to get my own API key - how do I do that? I looked at my account settings on tumblr and it isn't obvious where to get one. And once I do that, do I just replace the key currently in your .py file with the new one?

As far as I understand it, you can't just get the API key, you need to register an application that you would need the key for: https://www.tumblr.com/oauth/register
Otherwise I would also love to get my own key.
PS: I'm not a mass-downloader, I just like to save my Tumblr content every couple of months.

@Loreweaver15
Copy link

5000 requests per day is one thing, but the process doesn't even start for me--I just get the "Unauthorized getting" error a dozen times when I try to run it and then it stops.

@jorong1
Copy link
Author

jorong1 commented Jun 25, 2020

PS: I'm not a mass-downloader, I just like to save my Tumblr content every couple of months.

Same with me. What I'm confused is how the script worked previously for so long, with the old API key, for so many people and blog archives, rate limitation exception? I ran this script on tons of blogs in the past.

It sounds like we should be making our own oath app and getting our own oath API consumer key (which I've now done and the script works again) so we could at least do 5000 requests a day individually.

I think this issue could be closed assuming this requirement is stated in the README now, or if @bbolli applies for rate exception for the new key.

5000 requests per day is one thing, but the process doesn't even start for me--I just get the "Unauthorized getting" error a dozen times when I try to run it and then it stops.

This is because the new API key is restricted to 5000 requests a day and has hit that limit, given it's public. See above posts, you need to make your own oAuth app and replace the API key in the tumblr_backup.py script with it.

https://www.tumblr.com/oauth/register

@ghost
Copy link

ghost commented Jun 25, 2020

It sounds like we should be making our own oath app and getting our own oath API consumer key (which I've now done and the script works again) so we could at least do 5000 requests a day individually.

I don't even have the first clue how to build my own oath app - is there any way you could help me with that?

@slowcar
Copy link

slowcar commented Jun 25, 2020

To get an API key log in to Tumblr and go to https://www.tumblr.com/oauth/apps
Enter stuff into the fields marked with an asterisk. We just wrote "backup tumblr posts" into the description.
The whole process is automated, afaik there is no human interaction whatsoever, but as it is connected to your account you should probably stay civil.
Click two buttons, you get your API_KEY.
Open the backup.py from these tools, look for API_KEY and replace the existing with your new one.

@ghost
Copy link

ghost commented Jun 25, 2020

To get an API key log in to Tumblr and go to https://www.tumblr.com/oauth/apps
Enter stuff into the fields marked with an asterisk. We just wrote "backup tumblr posts" into the description.
The whole process is automated, afaik there is no human interaction whatsoever, but as it is connected to your account you should probably stay civil.
Click two buttons, you get your API_KEY.
Open the backup.py from these tools, look for API_KEY and replace the existing with your new one.

Thank you so much, that works! Somehow I thought someone was gonna check on my (non-existent) application and website before I got the key...

@cyle
Copy link

cyle commented Jun 25, 2020

Hey folks, random Tumblr engineer here! Please do not include Tumblr API keys in public repos! As stated in the API agreement, sharing your API key is not allowed. Instead, please set up your own API key for what you want to do, as has been described already in this thread. That's the best path forward for tools like this.

@bbolli bbolli closed this as completed in da3370c Jun 25, 2020
@daggerfang1
Copy link

To get an API key log in to Tumblr and go to https://www.tumblr.com/oauth/apps
Enter stuff into the fields marked with an asterisk. We just wrote "backup tumblr posts" into the description.
The whole process is automated, afaik there is no human interaction whatsoever, but as it is connected to your account you should probably stay civil.
Click two buttons, you get your API_KEY.
Open the backup.py from these tools, look for API_KEY and replace the existing with your new one.

wonder if they closed that loophole already. I'm trying to do the same thing and it's not accepting any of the application website and callback urls I am entering. I've tried both fake and actual websites.

@slowcar
Copy link

slowcar commented Jun 26, 2020

It's not a loophole, it's the official way to interact with the Tumblr API.
The URL values are checked for validity with a regular expression or something like that, make sure to have http or https in them.
for the application url I used the Tumblr blog url, callback url is not really needed unless you have authentication, I put http://localhost:3000 in there.

@daggerfang1
Copy link

It's not a loophole, it's the official way to interact with the Tumblr API.
The URL values are checked for validity with a regular expression or something like that, make sure to have http or https in them.
for the application url I used the Tumblr blog url, callback url is not really needed unless you have authentication, I put http://localhost:3000 in there.

putting localhost for the callback worked. thanks.

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

No branches or pull requests

6 participants