Skip to content

Instantly share code, notes, and snippets.

@Alirezaies
Last active June 3, 2017 16:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Alirezaies/4948297a1c6e82d23186a7fccf464dbc to your computer and use it in GitHub Desktop.
Save Alirezaies/4948297a1c6e82d23186a7fccf464dbc to your computer and use it in GitHub Desktop.
Get The Latest Activity Of A User In Github
#!/usr/bin/python3
# -*- Coding:utf-8 -*-
from xml.dom import minidom
import urllib.request
def activity(username):
"""This Function Returns Latest Activity Of A User In Github"""
xml_str = urllib.request.urlopen('https://github.com/%s.atom' %(username)).read()
xmldoc = minidom.parseString(xml_str)
linkslist = xmldoc.getElementsByTagName('link')
activity = xmldoc.getElementsByTagName('title')
latest_activity = activity[1].childNodes[0].nodeValue
latest_link = linkslist[2].attributes['href'].value
result = [latest_activity, latest_link]
return (result)
if __name__ == '__main__':
result = activity('AlirezaieS')
for record in result:
print(record)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment