tumblr / pytumblr Goto Github PK
View Code? Open in Web Editor NEWA Python Tumblr API v2 Client
License: Apache License 2.0
A Python Tumblr API v2 Client
License: Apache License 2.0
Clarification more than anything, but what's the syntax for using edit_post();
From what I can see:
client.edit_post("nameofblog", 39228373, detail)
I tried looking at the tests, but there isn't one set up.
Any guidance would be appreciated.
I see that I can define a Tweet text when posting. I can get it to post the text I create, but it no longer has the link to the post.
How do you get/append that to the Tweet text?
[ fantastically helpful module, BTW! ]
hello
sorry i'm french
i can not run
I have an error on the test
I have my tumblr key, but I do not understand all
Traceback (most recent call last):
File "/home/pi/pytumblr/pytumblr-master/tests/test_pytumblr.py", line 16, in setUp
with open('tests/tumblr_credentials.json', 'r') as f:
IOError: [Errno 2] No such file or directory: 'tests/tumblr_credentials.json'
=========--------------------------------------------------
Ran 33 tests in 0.335s
FAILED (errors=33)
The code is client.create_audio(tumblr_username, state="published", data=file_path) produces the errors below but when I do client.create_text(tumblr_username, state="published", body=file_path), a post is created on tumblr with the text of the file path, which is the correct file path for the audio.
Why might this be happening?
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/gunicorn/workers/sync.py", line 131, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1836, in call
return self.wsgi_app(environ, start_response)
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/var/www/vmail/handle_calls.py", line 389, in send_message
t_client.create_audio(tumblr_username, state="published", data=str_file)
File "build/bdist.linux-x86_64/egg/pytumblr/helpers.py", line 47, in add_dot_tumblr
return fn(_args, *_kwargs)
File "build/bdist.linux-x86_64/egg/pytumblr/init.py", line 387, in create_audio
return self._send_post(blogname, kwargs)
File "build/bdist.linux-x86_64/egg/pytumblr/init.py", line 509, in _send_post
return self.send_api_request("post", url, params, valid_options)
File "build/bdist.linux-x86_64/egg/pytumblr/init.py", line 542, in send_api_request
return self.request.post(url, params, files)
File "build/bdist.linux-x86_64/egg/pytumblr/request.py", line 61, in post
return self.post_multipart(url, params, files)
File "build/bdist.linux-x86_64/egg/pytumblr/request.py", line 111, in post_multipart
content = urllib2.urlopen(r).read()
File "/usr/lib64/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib64/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib64/python2.6/urllib2.py", line 1198, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib64/python2.6/urllib2.py", line 1162, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File "/usr/lib64/python2.6/httplib.py", line 914, in request
self._send_request(method, url, body, headers)
File "/usr/lib64/python2.6/httplib.py", line 954, in _send_request
self.send(body)
File "/usr/lib64/python2.6/httplib.py", line 759, in send
self.sock.sendall(str)
File "/usr/lib64/python2.6/ssl.py", line 203, in sendall
v = self.send(data[count:])
File "/usr/lib64/python2.6/ssl.py", line 174, in send
v = self._sslobj.write(data)
TypeError: write() argument 1 must be string or read-only buffer, not bytearray
ERROR:gunicorn.error:Error handling request
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/gunicorn/workers/sync.py", line 131, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1836, in call
return self.wsgi_app(environ, start_response)
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python2.6/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/var/www/vmail/handle_calls.py", line 389, in send_message
t_client.create_audio(tumblr_username, state="published", data=str_file)
File "build/bdist.linux-x86_64/egg/pytumblr/helpers.py", line 47, in add_dot_tumblr
return fn(_args, *_kwargs)
File "build/bdist.linux-x86_64/egg/pytumblr/init.py", line 387, in create_audio
return self._send_post(blogname, kwargs)
File "build/bdist.linux-x86_64/egg/pytumblr/init.py", line 509, in _send_post
return self.send_api_request("post", url, params, valid_options)
File "build/bdist.linux-x86_64/egg/pytumblr/init.py", line 542, in send_api_request
return self.request.post(url, params, files)
File "build/bdist.linux-x86_64/egg/pytumblr/request.py", line 61, in post
return self.post_multipart(url, params, files)
File "build/bdist.linux-x86_64/egg/pytumblr/request.py", line 111, in post_multipart
content = urllib2.urlopen(r).read()
File "/usr/lib64/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib64/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib64/python2.6/urllib2.py", line 1198, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib64/python2.6/urllib2.py", line 1162, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File "/usr/lib64/python2.6/httplib.py", line 914, in request
self._send_request(method, url, body, headers)
File "/usr/lib64/python2.6/httplib.py", line 954, in _send_request
self.send(body)
File "/usr/lib64/python2.6/httplib.py", line 759, in send
self.sock.sendall(str)
File "/usr/lib64/python2.6/ssl.py", line 203, in sendall
v = self.send(data[count:])
File "/usr/lib64/python2.6/ssl.py", line 174, in send
v = self._sslobj.write(data)
TypeError: write() argument 1 must be string or read-only buffer, not bytearray
When you call:
client.blog_info('seejohnrun')
you should get the same result as when calling:
client.blog_info('seejohnrun.tumblr.com')
We should just detect a .
in the name and if it's missing, append .tumblr.com
When attempting import in python 3.4 I get the following:
import pytumblr
File "D:\Python34\lib\site-packages\pytumblr__init__.py", line 1, in
from helpers import validate_params, validate_blogname
ImportError: No module named 'helpers'
I've just discovered by trial and error that when using client.create_photo method the data parameter (path to photo) must be str (not unicode). However the caption can be unicode. You should specify when you say "string" what type of string too (str or unicode). Thank you.
Hey guys,
I ran into an issue this morning with attempting to reblog posts and adding comments and tags to them. Turned out this was due to an outdated version of pytumblr in pypy that pip is installing (pytumblr 0.0.5). Removing it and reinstalling directly from the git repo (pip install git+https://github.com/tumblr/pytumblr.git) corrected it, but I'm sure others may be running into this issue as well.
I was getting especially confused because looking at the code on the Github repo made it look like it should be working but wasn't.
If updating the version in pypy isn't possible at this time maybe a note could be added to the README to let people know to install directly from git?
Thanks!
While iterating through posts, occasionally it will just sit... and sit... and sit... and sit...
By default, the httplib module that the oauth2 module uses has no timeout which means it will sit indefinitely. I'm not sure why nobody thought of this yet but why isn't there a default timeout set? I did it by creating a simple decorator and applying it to TumblrRequest().get().
Before signing my life away (CLA) and contributing my code, I thought I would bring this topic up and see if someone has already worked on this idea.
oauth1 is not well supported by python3, and I got errors when installing pytumblr. I am trying to fix by adding oauth2 support, but I'm not sure of my work process
I have been using this lib for quite sometime, recently I updated and I am not able to post videos and images using data='local filename' param.
I checked the commit history but did not find anything particular.
I get 401 not authorized for both image and video data post.
docstrings are not being carried through the decorator, making documentation for developers kinda difficult.
Minor sugar but should be something we support.
When calling an endpoint and receiving a 200, we should return the response
subobject of the JSON rather than the whole body
On line 414 in pytumblr/init.py please add state to the list of acceptable parameters to pass to the api call. It's impossible to queue something that's being reblogged without it.
This doesn't happen often, but once in a while, one of my tumblr calls fails.
I was wondering if there is a rate limit (I'll add a sleep() call , in case there is) or if these are just random failures.
This is the JSON response, when I use this library to get the followers of a blog.
{'meta': {'status': 401, 'msg': 'Not Authorized'}, 'response': []}
This is what I use to call it:
#client is declared elsewhere tumblr_followers = json.loads(json.dumps(client.followers('good')))
print tumblr_followers
I am able to use the library for getting Blog Posts, I was just wondering how I could get the total number of followers of a blog, since apparently I am not authorized to get this info? Thanks.
Francois
After reading some documentation, it turns out you need OAuth, I'm still relatively new to Python, how do I make an OAuth request to Tumblr? I have the OAuth Consumer Key/Secret/API Key/Secret.
Thanks for the help in advance.
Currently there is no support for answer posts. While answer posts cannot be created, they can be edited.
I tried adding the functionality myself, but ran into issues with pytumblr recognizing answer posts. Any ideas?
Hi, I'm trying to run this locally so I can import as photo post types.
I managed to start the server and load the landing page but clicking 'Connect to Tumblr' gives me an internal server error. Please help :$
p.s. I'm not familiar with Python and I couldn't get the server to start using a config file, getting the following error:
$ WP2TUMBLR_SETTINGS=settings.py; python wp2tumblr.py
Traceback (most recent call last):
File "wp2tumblr.py", line 24, in <module>
app.config.from_envvar('WP2TUMBLR_SETTINGS')
File "/Library/Python/2.7/site-packages/flask/config.py", line 107, in from_envvar
variable_name)
RuntimeError: The environment variable 'WP2TUMBLR_SETTINGS' is not set and as such configuration could not be loaded. Set this variable and make it point to a configuration file
Your instructions list settings.py but the sample is saved as settings.cfg, I tried saving both (in same folder as wp2tumblr.py and in /settings/settings.py) but nothing worked.
So I tried hardcoding the settings into the wp2tumblr.py file, which got it to run but maybe that's causing a 500 error?
app.config['TUMBLR_CONSUMER_KEY'] = '####'
app.config['TUMBLR_CONSUMER_SECRET'] = '####'
app.debug = False
app.config['DEBUG'] = False
app.config['SECRET_KEY'] = 'development'
app.config['LOG_FILE'] = '/log/log_file.log'
The field type is listed as an optional argument for posts() function but the validate_params() function disallows type and raises an exception upon its inclusion, making it impossible to call with the type parameter.
i.e., this code:
args = {'type': 'text', 'limit':2}
posts = client.posts(urls[0], **args)
returns this error:
C:\Users-Removed-\AppData\Local\Enthought\Canopy\User\lib\site-packages\pytumblr-0.0.5-py2.7.egg\pytumblr\helpers.pyc in validate_params(valid_options, params)
25 if disallowed_fields:
26 field_strings = ",".join(disallowed_fields)
---> 27 raise Exception("%s are not allowed fields" % field_strings)
28
29 def validate_blogname(fn):
Exception: type are not allowed fields
I've attempted to use pytumblr to reblog a post with an image however I cannot seem to do this properly.
Noticing the reblog method doesn't accept kwargs caption, link, source, and data I added those to the accepted options in init.py. Then naturally I called reblog like: client.reblog(your_blog_name,id=i,reblog_key=key,type='photo',source=ima)
however this results in empty reblogs that do not have the photo uploaded.
additionally, I have tried manually calling client.request.post() as such:
url = "/v2/blog/" + your_blog_name + ".tumblr.com/post/reblog"
kwargs = {"type":"photo", "source":ima, "id":i, "reblog_key":key}
print client.request.post(url, kwargs)
with the same result.
How would I reblog with a photo added?
Is fixed by the Python 3 support pull request
Which, pending it being merged into master, you can install with
pip install git+git://github.com/dianakhuang/pytumblr.git@diana/python-3-support
Hopefully this will save someone 5 minutes
Hi! After install it, I have the following SSL error by calling info() method:
Traceback (most recent call last):
File "./tarteso.py", line 48, in <module>
main()
File "./tarteso.py", line 35, in main
descargaFavs()
File "./tarteso.py", line 28, in descargaFavs
myInfo = client.info()
File "build/bdist.linux-armv7l/egg/pytumblr/__init__.py", line 36, in info
File "build/bdist.linux-armv7l/egg/pytumblr/__init__.py", line 540, in send_api_request
File "build/bdist.linux-armv7l/egg/pytumblr/request.py", line 41, in get
File "build/bdist.linux-armv7l/egg/oauth2/__init__.py", line 682, in request
File "/usr/local/lib/python2.7/dist-packages/httplib2-0.9-py2.7.egg/httplib2/__init__.py", line 1593, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/usr/local/lib/python2.7/dist-packages/httplib2-0.9-py2.7.egg/httplib2/__init__.py", line 1335, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/usr/local/lib/python2.7/dist-packages/httplib2-0.9-py2.7.egg/httplib2/__init__.py", line 1257, in _conn_request
conn.connect()
File "/usr/local/lib/python2.7/dist-packages/httplib2-0.9-py2.7.egg/httplib2/__init__.py", line 1021, in connect
self.disable_ssl_certificate_validation, self.ca_certs)
File "/usr/local/lib/python2.7/dist-packages/httplib2-0.9-py2.7.egg/httplib2/__init__.py", line 80, in _ssl_wrap_socket
cert_reqs=cert_reqs, ca_certs=ca_certs)
File "/usr/lib/python2.7/ssl.py", line 487, in wrap_socket
ciphers=ciphers)
File "/usr/lib/python2.7/ssl.py", line 241, in __init__
ciphers)
ssl.SSLError: [Errno 185090050] _ssl.c:344: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
If I do print certifi.where() I have the following path:
/usr/local/lib/python2.7/dist-packages/certifi-14.05.14-py2.7.egg/certifi/cacert.pem
This run over OSX but crash over Ubuntu on an ARM processor.
How can I solve it?
( Note: could be having the same problem as #34 )
I've copied all the credentials directly from the API explore console (where all calls complete successfully), and provided them to the Pytumblr client. However, I still receive 401 errors for any requests to the API. I have confirmed my configuration with someone at Tumblr, as well.
Looks like pytumblr isn't on pypi yet?
https://pypi.python.org/pypi/pytumblr
Is empty. Doing this woul make pip installations easier.
If it's no longer supported would be cool if you could take it off the readme.
As I don't have a consumer key or consumer secret as I can't seem to find either on the tumblr site I've set up my authentication like so.
client = pytumblr.TumblrRestClient(
'oauth key',
'oauth secret'
)
This doesn't seem to work, so the question is where do I get the other keys? or are they not necessary as I suspected?
Hi,
This is quite an impressive library and very helpful.
How do I add meta tags to the blog header though?
For twitter cards, I need to add this per blog.
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@flickr" />
<meta name="twitter:title" content="Small Island Developing States Photo Submission" />
<meta name="twitter:description" content="View the album on Flickr." />
<meta name="twitter:image" content="https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg" />
Many Thanks
Why "type" is not allowed?
import pytumblr
client = pytumblr.TumblrRestClient('KEY')
client.posts('snow.tumblr.com', type='photo', limit=10)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
...
Exception: type are not allowed fields
PS: PyTumblr==0.0.5
Hello,
I received this error when i launched
I did give correct "consumer key" and "consumer secret" when prompted
I am using latest python and installed required modules it requested using
python setup.py install
Python 2.7.6
Appreciate your help...
Traceback (most recent call last):
File "interactive_console.py", line 65, in
tokens = new_oauth(yaml_path)
File "interactive_console.py", line 32, in new_oauth
print '\nPlease go here and authorize:\n%s?oauth_token=%s' % (authorize_url, request_token['oauth_token'][0])
KeyError: 'oauth_token'
The TumblrRestClient.create_photo
method raises a UnicodeDecodeError
when the filename is a unicode
instance. Coercing it to str
fixes the problem. Here's an example traceback:
>>> import pytumblr
>>> t = pytumblr.TumblrRestClient(consumer_key, consumer_secret, oauth_token, oauth_token_secret)
>>> filename = u"/path/to/file"
>>> t.create_photo(blog_name, data=filename)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/justin/.virtualenvs/machino/lib/python2.7/site-packages/pytumblr/helpers.py", line 44, in add_dot_tumblr
return fn(*args, **kwargs)
File "/Users/justin/.virtualenvs/machino/lib/python2.7/site-packages/pytumblr/__init__.py", line 281, in create_photo
return self._send_post(blogname, kwargs)
File "/Users/justin/.virtualenvs/machino/lib/python2.7/site-packages/pytumblr/__init__.py", line 505, in _send_post
return self.send_api_request("post", url, params, valid_options)
File "/Users/justin/.virtualenvs/machino/lib/python2.7/site-packages/pytumblr/__init__.py", line 538, in send_api_request
return self.request.post(url, params, files)
File "/Users/justin/.virtualenvs/machino/lib/python2.7/site-packages/pytumblr/request.py", line 56, in post
return self.post_multipart(url, params, files)
File "/Users/justin/.virtualenvs/machino/lib/python2.7/site-packages/pytumblr/request.py", line 101, in post_multipart
content_type, body = self.encode_multipart_formdata(params, files)
File "/Users/justin/.virtualenvs/machino/lib/python2.7/site-packages/pytumblr/request.py", line 137, in encode_multipart_formdata
body = CRLF.join(L)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128)
>>> t.create_photo(blog_name, data=str(filename))
{u'id': ...}
I think there is a problem with the reblog function, am getting
TypeError: reblog() takes exactly 2 arguments (4 given)
when i add my username and this
File "/pytumblr/helpers.py", line 41, in add_dot_tumblr
if (len(args) > 1 and ("." not in args[1])):
TypeError: argument of type 'int' is not iterable
when i dont add a username.
If you look at https://www.tumblr.com/docs/en/api/v2#posting and go down to Link Posts, there is a "thumbnail" parameter, which is not accepted by this library. To get it accepted, modify __init__.py
:
def _post_valid_options(self, post_type=None):
...
elif post_type == 'link':
valid += ['title', 'url', 'description', 'thumbnail']
And add 'thumbnail' to the valid list. Now if you create a link with a thumbnail, the thumbnail will also appear.
I'm attempting to use client.posts() to retrieve a pseudo-mirror of my tumblr in order to echo them over to an associated twitter account.
My TumblrRestClient appears to be set up properly as client.info() or client.posts('metroidvanias') returns results.
As soon as I attempt to send a limit or offset, I get:
print(client.posts('metroidvanias', {'limit': 1}))
{'meta': {'status': 500, 'msg': 'Server Error'}, 'response': {'error': 'Malformed JSON or HTML was returned.'}}
Super python newb, so here are some other details:
Any idea of where I'm going wrong with this?
Thanks, and best regards,
-Matt
While most of the posts that user copy paste runs fine however I can see lot of ascii errors at
resp = self.client.create_text(target_blog.id, title=post.title, body=post.content, tags=tags, date=post.date)
The error is in general with title or body.
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 622: ordinal not in range(128)
While I do try to " decode('utf-8', 'ignore') " but still in vain.
I get errors only from this library.
Any thoughts?
I have the following code to post a blog on Tumblr through Tumblr API.
post = client.create_text("xxx.tumblr.com",
state="published",
tags=utag_list,
format='html',
tweet=tweet.encode('utf-8'),
slug=sluged_header,
title=news.head_line.encode('utf-8'),
body=body)
Strangely the tweet parameter doesnt do anything.
Looking at my blog source, I can see:
<li><a href="https://twitter.com/intent/tweet?text=Teenagers%20rescue%20elderly%20couple%20from%20sinking%20after%20car%20crashes%20into%20lake%20-%20Teenage%20wind-surfing...%20http%3A%2F%2Ftmblr.co%2FZ_F3uj1qlCL9u" class="share-item twitter" target="_blank">Tweet</a></li>
This is the default tweet message generated. Somehow my custom tweet message is completely ignored. And not generated in source. Hence the tweet sharing doesn't see the custom message. Any advice please?
From https://api.tumblr.com/console/calls/blog/posts, to include reblog info in each post I can do this:
client.posts('staff.tumblr.com', reblog_info=True)
In practice I have to do this:
client.posts('staff.tumblr.com', reblog_info='true')
because pytumblr adds uppercase boolean values as GET parameters ('True'), which the Tumblr API ignores.
is there any way to edit, delete or create pages from this py? i wish to update a custom page from running an instance of this py. Thanks!
Updating a post requires you knowing what type a post you're updating and the id of the post. You'll be able to supply to the post any of the options given above for updates.
client.edit_post(blogName, type="photo", id="12312" title="OK", data="/Users/johnb/mega/awesome.jpg"); # edit a post
The Tumblr API documentation says that the tags
parameter for creating a new blog post should be of type String
and contain Comma-separated tags for this post
.
When I attempt to use the following:
client.create_photo(blogName, source='http://i.imgur.com/l6PpCfK.jpg', tags='dog,corgi,puppy')
It ends up like this on Tumblr:
I've also tried it with spaces after the commas and with double quotes. Am I doing something wrong?
Hi,
for video posts the date parameter does not seem to be observed for video uploads.
with my_date = '16.12.2014'
post_id = client.create_photo("xxx", state="published", date=my_date,
caption=caption, tags=tags, data=tumblr_photos)
creates the right post
post_id = client.create_video("xxx", state="published", date=my_date,
caption=caption, tags=tags, data=tumblr_video)
does not...
Daniel
We should try to support python3, it's 2.X eventually will be deprecated and we should do our best to make sure that we can support it going forward.
Right now, our documentation is kind of lacking. We should go a bit more in depth on all the different types of ways to issue a request. Discussion was started in #15.
I'm looking for a way to determine how many notes a given post received through the user's blog. Currently I can count how many people reblogged a post from a given user, but I can't determine how to tell whether a like came from a specific blog or not. My work around for this was to look at the activity page and use that to determine how popular a given post was, but I don't see a way to access the activity page using the API.
Any thoughts?
Create an interactive console people can use to launch directly into the client with keys filled out.
If keys don't exist, walk them through the 3-legged OAuth state and write a JSON file to their home directory.
This seems similar to issue 23. But I'm running python 2.7
I am not able to use the type argument to return posts of a certain type:
client.posts('bassrx',type='video', limit=1)
Output:
Traceback (most recent call last):
File "G:\programming\python\tumblrapi.py", line 13, in
photo_posts = client.posts('bassrx',type='video', limit=1)
File "C:\Python27\lib\site-packages\pytumblr-0.0.5-py2.7.egg\pytumblr\helpers.
py", line 44, in add_dot_tumblr
File "C:\Python27\lib\site-packages\pytumblr-0.0.5-py2.7.egg\pytumblr__init__
.py", line 124, in posts
File "C:\Python27\lib\site-packages\pytumblr-0.0.5-py2.7.egg\pytumblr__init__
.py", line 490, in send_api_request
File "C:\Python27\lib\site-packages\pytumblr-0.0.5-py2.7.egg\pytumblr\helpers.
py", line 27, in validate_params
Exception: type are not allowed fields
I also tried:
client.posts('bassrx','video', limit=1)
Output:
Traceback (most recent call last):
File "G:\programming\python\tumblrapi.py", line 13, in
photo_posts = client.posts('bassrx','video', limit=1)
File "C:\Python27\lib\site-packages\pytumblr-0.0.5-py2.7.egg\pytumblr\helpers.
py", line 44, in add_dot_tumblr
TypeError: posts() takes exactly 2 arguments (4 given)
If I'm doing this wrong, can it be explained how to return posts using the type argument? As it doesn't seem to be spelled out anywhere.
Like if I want to find all the posts with the tag "pizza" how would I do that?
edit: never mind
Hey guys and gals,
I'm starting to transition myself over to Python 3 and decided to play around with pytumblr as a part of that.
Unfortunately, it appears that oauth2 doesn't play nice with Python 3. github issue
Any plans on transitioning the package to using oauthlib? From what I'm reading it appears to be the new go to package in Python for interacting with OAuth.
Even though EOL for Python 2 is a ways off, using oauthlib looks like it would allow someone who actually needs to use Python 3 and would like to use the pytumblr package, the ability to do so easily.
Thanks!
Anytime I try uploading an image I keep getting {"meta":{"status":401,"msg":"Not
Authorized"},"response":[]}. with unicode string as the blog name
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.