#!/usr/bin/python

import json
import urllib2
import os

user = os.getenv('USERNAME')
GITHUB_API_TOKEN = '3f7c62cd0799dfe4d10366da91b039a29d4ba839'
SLACK_TOKEN = 'xoxp-7122983504-282559976902-283824463685-47c615e52eb38f20fecbefc8632519bd'

uri = 'https://github.ibm.com/api/v3/repos/CIO-Incentives-BIM/zOS/branches'

request = urllib2.Request(uri)
request.add_header('Authorization', 'token %s' % GITHUB_API_TOKEN)
response = urllib2.urlopen(request).read()
out = open("./branch.json", "wb")
out.write(response)
out.close()
'''
decoded = json.load(open('./.out.json'))
print type(open('./.out.json'))

print user

print "[",(decoded["files"].__len__()), "files changed ]\n"
print (decoded.__len__())
print type(decoded)

for FILE in decoded["files"]:
    print FILE["status"], FILE["filename"]
'''

