Using the Tumblr API - python

It's something new for me working with API, but I really want to create something good. Maybe somebody of you've already worked with Tumblr API (not necessary with Tumblr, it can be Twiter or something else ) and could show me the simplest examples of retrieving of some data.
P.S: I've read the documentation of using API but I don't know how it works and what I should do to get the data. So if you can, I'll be very happy.
I was advised to use a Tumblr client, but now there is new question. How to install and how to use it in my own code?

You can use the official Tumblr client
If you want to write a client from scratch take a look in requests library.
A simple GET request will be something like this requests.get('https://api.github.com/user')

Use pip to install python packages.
After installing... From the shell, run:
pip install pytumblr
or
pip3 install pytumblr

Related

Amazon API In Python

What is the best way to use the amazon Product Advertising API in Python?
Seen previous answers, but all outdated and closed.
Most modules for the API call urllib which has errors with Python3 and SSL’s.
If anyone could give me the best way to work with it, it would greatly help.
Thanks
If you want to call the api yourself, then I find the requests module fantastic! Otherwise there is an AWS SDK for Python that you can use.
The boto3 library is excellent and actively maintained. It doesn't have much support for MWS, but does support AWS very well.
The AWS has their own python CLI package.
https://aws.amazon.com/cli/
pip install awscli

Workarounds to get Google sign-in functioning with Python 2.6 and pyOpenSSL 0.10-2

I'm trying to get Google sign-in working using their Python API but the server I'm on (4UHosting) has Python 2.6 and pyOpenSSL 0.10-2 (5-years old).
This means that the API's call to OpenSSL.crypto.verify() fails as it doesn't exist in this version.
I can't install these myself, even --self as they require compiler use which I don't have. The admins are reluctant to install any updates that are not vetted. They won't install pyOpenSSL or Python 2.7 locally just for me. I can't find documentation from pyOpenSSL 0.10-2 that would have an equivalent function to verify().
I'm looking for some suggestions as where to head from here.
Any suggestions would be greatly appreciated,
Cyrille
A few ideas:
You could directly make your API calls to the Google API Endpoints instead of using the Python client library, for example, the token info endpoint can be used to verify tokens
You could do sign-in operations client-side and transfer data to your server once a session is attached
You could use another language (e.g. Ruby) for the sign-in operations

How to use Python and Mailchimp to send an email?

I have been reading a lot on the Internet to know how I can use Python to send emails using mailchimp API. It seems that the website is so complected and doesn't have any example.
Please, could you guide me to any example including a Python use?
What I tried so far:
I installed the library from pip using:
pip install mailchimp;
I have created the campain;
I have created the lists;
But yet, I couldn't know how to send the emails programmatically.
If you want to trigger a campaign see:
https://apidocs.mailchimp.com/api/2.0/campaigns/send.php
The typical module mailchimp at pypi supports it as followed.
from mailchimp import Mailchimp
mailchimp = Mailchimp(api_key)
mailchimp.campaigns.send(campaign_id)
Sourcecode at: https://bitbucket.org/mailchimp/mailchimp-api-python/src/32ed2394d6b49d7551089484221fa3ee019bee37/mailchimp.py?at=master
Hope it helps.
Cheers,
mrcrgl

Sending http post request in buildbot

I am using buildbot version 0.8.5 and need to send an HTTP post request from it as a step. After searching for it on internet, I found that the latest version 0.8.8 has a step called HTTPStep for doing so. Is there any similar step in the older version?
I know it can be done using batch file or python program using urllib2. but is there any other way to do it?
You should be able to use the HTTPStep from 0.8.8 (provided you install the necessary dependency (https://pypi.python.org/pypi/txrequests and http://python-requests.org/)). Just copy the http.py file from 0.8.8 next to your master.cfg, and have your master.cfg import the HTTPStep derived class POST from module http instead of buildbot.steps.http.
Some small adjustments might be needed to make it work with the API of 0.8.5 though.
Just my thoughts..As far as I know it is better to use a python script from a build step. Simple and easy to control. The logic being:
the entire buildbot is inside one http connection/session and sending another http request somewhere might have issues with the connection/session.
from the buildbot httpstep description, you need to install additional python packages which might be not be so convenient to do on multiple slaves/masters.

How to use "import oauth2" in Google App Engine?

I want to use Tumblr's API v2, which includes OAuth. so I need to find a OAuth module.
I am supposed to use it like this:
import oauth2 as oauth
I have found the oauth2 source code here: https://github.com/simplegeo/python-oauth2
If I want to use it in my Linux Ubuntu 10.08, whats the process? I have installed git. I notice that there is a "setup.py", so I just have to run it? The ReadME https://github.com/simplegeo/python-oauth2/blob/master/README.md doesnt mention how to install, maybe it is too newbie.
If I want to use it in Google App Engine, how can I do it?
Thanks for your help. I am pretty new to GIT stuff.
On Ubuntu, simply sudo apt-get install python-oauth2 and the package will be installed for you automatically.
For AppEngine, you might take a look at the Google API Python Client's appengine examples. They have an OAuth2 client specifically designed to work with AppEngine.

Categories