2012-10-01
Pixbin.us just got an API
Took us awhile but Pixbin just got an API. Well…the beginning of one at least. You heard it here first folks. :) You can now upload images from your code.
How to do it?! Here’s an example:
import base64, urllib, urllib2 with open('image.jpeg') as f: imagedata = base64.b64encode(f.read()) data = urllib.urlencode({'image': imagedata, 'caption': 'test'}) u = urllib2.urlopen('http://pixbin.us/api/post/', data) print u.readlines()
The example above is in Python but the same principles apply for your language of choice. Just base64 encode an image and send a POST request with the shown parameters to the given link. The response you get back will be a json like so:
{"link": "http://pixbin.us/abcabc"}
This can be very useful if you want to, let’s say, quickly share a screenshot with somebody. We have a very handy little bash script that let’s you do just that. You can check it out here. Special thanks to Senko for making the script.
Check back next week for more, hopefully useful, stuff. :)
Did you like this post?
If your organization needs help with implementing modern DevOps practices, scaling you infrastructure and engineer productivity... I can help! I offer a variety of services.Get in touch!