Closed tehgarra closed 5 years ago
The json returned by the API is not "pretty-printed", this is to save bytes added by newlines and spaces. The pytumblr library just dumps this json into a dict
object, and dictionaries are not typically "pretty printed" by coding tools. If you want a pretty-printed format, here's an example in the standard python REPL:
>>> import json
>>> from pytumblr import TumblrRestClient
>>> c = TumblrRestClient('YOUR API KEY HERE')
>>> blog_info = c.blog_info('staff.tumblr.com')
>>> formatted = json.dumps(blog_info, indent=2) # indent with 2 spaces
>>> print(formatted) # print to show newlines instead of '\n'
{
"blog": {
"ask": false,
"ask_anon": false,
"ask_page_title": "",
"can_subscribe": false,
"description": "",
"is_nsfw": false,
"name": "staff",
"posts": 2338,
"share_likes": false,
"subscribed": false,
"title": "Tumblr Staff",
"total_posts": 2338,
"updated": 1543858264,
"url": "https://staff.tumblr.com/",
"uuid": "t:0aY0xL2Fi1OFJg4YxpmegQ",
"is_optout_ads": true
}
}
>>>
Thank you!
Through the test console on tumblr website, it looks properly formatted, but just displays a long line of code in ide and standalone console.