import socket
import sys
import re
import time
import requests
from PIL import Image

##showing img script doesn't working properly
##imgpath = raw_input('Input file name or path')
##image = Image.open(imgpath)
##image.show
def foll():
  your_url ="https://api.twitch.tv/kraken/channels/examplechannelname/follows?limit=1"
  header = {"Client-ID": "XXXXX-XXX"}
  r = requests.get(your_url, headers=header)
  print (r.json()['_total'])  
  num_of_follow = r.json()['_total'] ## print number of folowers
  last_follower = r.json()['follows']['0']['user']['display_name'] ## last follower
  print last_follower ## print last follower
  textlastfoll = 'Last follower: ' + last_follower
  open('foll.txt', 'w').write(textlastfoll)
  allfollow = "All followers: " + str(num_of_follow)
  open('follall.txt', 'w').write(allfollow)  
  time.sleep(10)
  
sub_goal = raw_input('Input your subs goal')
followers_goal = raw_input('Input your followers goal')
print followers, "/", followers_goal   ## print followers ratio to followers goal (all followers not the newest)  

n = 1
while(n>0):
  foll()
