Skip to content

Instantly share code, notes, and snippets.

@ralmn
Last active August 29, 2015 14:09
Show Gist options
  • Save ralmn/b8f56a3b74628c28f01c to your computer and use it in GitHub Desktop.
Save ralmn/b8f56a3b74628c28f01c to your computer and use it in GitHub Desktop.
Image Nexus
#!/usr/bin/python
# -*- coding: utf-8 -*-
URL="https://developers.google.com/android/nexus/images"
import urllib2
request = urllib2.Request(URL)
response = urllib2.urlopen(request)
# check content type:
lm =response.info().getheader('last-modified')
n='Wed, 05 Nov 2014 02:44:20 GMT'
from twitter import Twitter, OAuth, TwitterHTTPError
OAUTH_TOKEN = 'your oauth token'
OAUTH_SECRET = 'your oauth secret'
CONSUMER_KEY = 'your consumer key'
CONSUMER_SECRET = 'your consumer secret'
#[Tweet auto] #Fake #Test Update de la page des images de Nexus %s cc @ralmn45 @Ralf_Red" % URL
if lm != n:
f = open('.nexusimg','r')
r = f.read()
f.close()
if lm != r:
t = Twitter(auth=OAuth(OAUTH_TOKEN, OAUTH_SECRET,
CONSUMER_KEY, CONSUMER_SECRET))
t.statuses.update(
status="[Tweet auto] Update de la page des images de Nexus %s cc @ralmn45 @Ralf_Red" % URL)
rf = open('.nexusimg','w')
rf.write(lm)
rf.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment