Total Newb Question: Use Tumblr API Through Pythonista?
tyehill last edited by
I want to use Pythonista to automate reblogging from one of my tumblr blogs to another (they're my kids' sites that I set up for my parents. When I have a blog that features both of them I want it to be reblogged automatically based on a tag).
I want to either have a script that looks for all recent posts and checks to see which ones haven't been reblogged yet and then reblog them, or have one that simply reblogs the most recent post (doesn't need to use a special tag). The second one being easiest and not requiring the storing of data in some kind of database, but the first one would be BY FAR my preferred solution.
This Python Tumblr REST library exists: https://github.com/tumblr/pytumblr
Would it be possible to load the four or five scripts from this open source project into Pythonista and then use it to make REST calls to Tumblr from a script? Preferably this would be automated with Workflow.app or just as a shortcut on the App Launcher or something. I'm asking before I dive in and buy Pythonista.
dgelessus last edited by
This should be possible. It's relatively easy to install third-party libraries in Pythonista (as long as they don't contain any C/Fortran/whatever code - the library you linked to does not). Pythonista has no built-in functionality for this, however there is the excellent Unix shell clone stash which you can use to install libraries, either automatically from PyPI or manually by downloading and extracting the source archive.
Tizzy last edited by Tizzy
To answer the other part of your question, you CAN have a shortcut in the app launcher. (You could potentially do that through workflow too (but that's an extra unnecessary step that would be the slowest way to launch).
A: After you have your script, use this tool to create a home screen shortcut.
B: Alternatively you could use the Xcode template to create truly standalone apps https://github.com/omz/PythonistaAppTemplate
C: Alternatively you could use something like Launch Center Pro to organize all sorts of quick actions, including links to specific scripts.
Tizzy last edited by
@dgelessus could you elaborate how to install using Stash from a github page?
pip install pytumblryields "no package found with that name" The same command works on OS X however.
note, @tyehill that this doesn't mean you can't install it, just that pip in StaSh doesn't seem to have this package in its index.
ywangd last edited by
@Tizzy StaSh pip is case sensitive, so you need to run
pip install PyTumblr
You can install from a github repo with
pip install OWNER/REPO, e.g.
pip install tumblr/pytumblr. Note this requires the latest stash.
One thing to note is that PyTumblr requires httpretty. The latest stash pip can handle dependencies and will install httpretty automatically. Httpretty does not depend on any other packages but its setup file is not well written and declares a dependency as
#HTTPrettydoesn'thaveanyrequirementspersesofar.yay!. An error will be generated as pip cannot find this dependency which can be safely ignored.
tyehill last edited by
Thanks for all the great replies! I'm going to go ahead and buy it and dive right in. I'll probably end up having loads of other questions and whatnot and will visit this forum often.