Skip to main content

A sneaky Tumblr API

Project description

Tumblr with no OAuth

TL;DR: tumblr_noauth is a Python package which provides a TumblrSession(email, password) class which extends requests.Session and provides a Tumblr login/logout process.

Tumblr supplies an OAuth API which you can use for fairly simple tasks, mostly for dashboard-like functions; there’s a lot left out, such as

  • Checking if a URL is available for creating a new blog; the endpoint at requires authentication
  • Probably others which I forget

With no official way to access that data, tumblr_noauth provides a workaround: emulate a whole Tumblr “session”; you feed it a username and password (which aren’t stored, even in the TumblrSession object) and it performs a login request (and a logout request with __exit__ or at the end of the with clause).

Under the hood, a TumblrSession is a requests.Session with some special behavior optimized for use with Python’s with statements.

The following methods in a TumblrSession object are specialized to make the prefix optional:

  • delete
  • get
  • head
  • options
  • patch
  • post
  • put

i.e. the high-level HTTP requests.

Example usage:

import json
import tumblr_noauth

with open('creds.json') as f:
    creds = json.load(f)

with TumblrSession(creds['email'], creds['password']) as session:
    data = {'name': staff}
    resp ='check_if_tumblelog_name_is_available',

    print(resp, ';', resp.text)

Where the with clause automatically logs in and out of Tumblr.

For additional “authenticity”, you might want to set your headers to something like...

# this is lying
headers = {
    'Host': '',
    'Origin': '',
    'Referer': '',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36',
    'X-Requested-With': 'XMLHttpRequest',

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

tumblr_noauth-0.1.0-py3-none-any.whl (4.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page