Skip to content

Instantly share code, notes, and snippets.

@mattjbarlow
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattjbarlow/de4962f261caa4497717 to your computer and use it in GitHub Desktop.
Save mattjbarlow/de4962f261caa4497717 to your computer and use it in GitHub Desktop.
Git Events
import requests
import time
import socket
TCP_IP = '127.0.0.1'
TCP_PORT = 2003
github_user = 'mattjbarlow'
for a in range(1,10):
events_url = 'https://api.github.com/users/' + github_user + '/events?page=' + str(a)
r = requests.get(events_url)
for i in r.json():
git_time = i['created_at']
dt = time.strptime(git_time, "%Y-%m-%dT%H:%M:%SZ")
timestamp = time.mktime(dt)
s = socket.socket()
s.connect((TCP_IP, TCP_PORT))
message = "github.{}.{} 1 {}\n".format(i['actor']['login'],i['repo']['name'], \
int(timestamp))
print message
s.sendall(message)
s.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment