Skip to content

Instantly share code, notes, and snippets.

@datamafia
Created March 26, 2014 00:34
Show Gist options
  • Save datamafia/9774592 to your computer and use it in GitHub Desktop.
Save datamafia/9774592 to your computer and use it in GitHub Desktop.
Waiting for the Bitwig - send DM to my Twitter account on change
#!/usr/bin/env python
import urllib2
import time
class bitwig:
running = None
last_size = 0
def __init__(self):
if not self.running:
self.running = 1
while 1 == 1 :
self.run()
time.sleep(10) # pause 10 sec
def run(self):
response = urllib2.urlopen('http://www.bitwig.com/en/bitwig-studio') #target url
html = response.read()
sz = len(html)
print str(sz)
if sz != self.last_size: # reminder : will send a DM on start up
print 'from '+ str(self.last_size) + ' to ' + str(sz)
msg = str(self.last_size) + '-' + str(sz)
self.last_size = sz
response = urllib2.urlopen('http://localhost:3000/test/omnimono/'+msg) #local rails app sends me DM in twitter
go = bitwig()
@datamafia
Copy link
Author

Thx, I wrote this fast and cheap. Much tighter!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment