I am using python for making a post request on tumblr /posts endpoint but getting an error response. This is the code. Tumblr api use oauth1 authentication.
import requests
from requests_oauthlib import OAuth1
consumer_key = "0000000000000000000000000000000000000"
consumer_secret = "0000000000000000000000000000000000000"
token = "0000000000000000000000000000000000000"
token_secret = "0000000000000000000000000000000000000"
oauth = OAuth1(
consumer_key,
client_secret=consumer_secret,
resource_owner_key=token,
resource_owner_secret=token_secret,
signature_method='HMAC-SHA1'
)
url = 'https://api.tumblr.com/v2/blog/aisamarsha-blog.tumblr.com/posts'
params = {
'type': 'photo',
'state': 'published',
'tags': 'tag1, tag2, tag3',
'content': [
{
'type': 'image',
'url': 'http://69.media.tumblr.com/b06fe71cc4ab47e93749df060ff54a90/tumblr_nshp8oVOnV1rg0s9xo1_250.jpg',
'caption': 'This is the caption for image1'
},
{
'type': 'image',
'url': 'http://69.media.tumblr.com/b06fe71cc4ab47e93749df060ff54a90/tumblr_nshp8oVOnV1rg0s9xo1_250.jpg',
'caption': 'This is the caption for image2'
},
{
'type': 'image',
'url': 'http://69.media.tumblr.com/b06fe71cc4ab47e93749df060ff54a90/tumblr_nshp8oVOnV1rg0s9xo1_1280.jpg',
'caption': 'This is the caption for image3'
}
]
}
response = requests.post(url, auth=oauth, json=params)
print(response.json())
I want to post blog with multple images, tags and caption on tumblr.