Geeksphone out of stock, again

It seems the geeksphone is out of stock again! Firefox OS is having the attention it deserves
and I'm happy for it.

When I was waiting for the shop to open, I create a small script to know when was opened again,
just for fun. If you are eager to get one like I was, maybe you would like to use it. :-)

import requests
import time

WAIT = 600
r = requests.get('http://shop.geeksphone.com')
while True:
    if r.status_code == 200:
        print 'Geeksphone available'
    time.sleep(WAIT)

You can change the print to send you an email for example.

import requests
import time
import smtplib
from email.mime.text import MIMEText

WAIT = 600
r = requests.get('http://shop.geeksphone.com')
while True:
    if r.status_code == 200:
        server = [email protected]'
        client = [email protected]'
        msg = MIMEText('Geeksphone available!')
        msg['Subject'] = 'Important message'
        msg['From'] = server
        msg['To'] = client
        s = smtplib.SMTP('localhost')
        s.sendmail(server, [client], msg.as_string())
        s.quit()
        break
    time.sleep(WAIT)

If you want to send an email to yourself, install an application like
Postfix or Exim for Python to be able to send it.

Javier Aguirre

Read more posts by this author.

comments powered by Disqus