In [ ]:
!pip install -U requests

In [ ]:
!pip install -U facebook-sdk

In [ ]:
token = raw_input()

In [2]:
import facebook

In [3]:
graph = facebook.GraphAPI(token, version="2.5")

In [4]:
%pylab inline
pylab.rcParams['figure.figsize'] = (15, 10)


Populating the interactive namespace from numpy and matplotlib

In [5]:
img = zeros(shape=(1024,1024,3))
Y, X = ogrid[0:1024,0:1024]

In [6]:
img = zeros(shape=(1024,1024,3))
x=y=0.
for k in range(15):
    x, y = (sin(x)) - cos(y)**2 +(X-512.)/512, 2*sin(x)*cos(y)+(Y-512.0)/512;
img[:,:,0] = x**2+y**2
img[:,:,1] = 15*abs(x)
img[:,:,2] = 15*abs(y)
imshow(img/2);



In [11]:
imsave("foo.png", img/2)

In [12]:
imshow(imread('foo.png'))


Out[12]:
<matplotlib.image.AxesImage at 0xc806780>

In [13]:
graph.put_photo(image=open('foo.png', 'rb'), message='generated using python')


Out[13]:
{u'id': u'10205389756778204',
 u'post_id': u'10201382289514027_10205389756778204'}

In [ ]: