Last active
June 3, 2017 16:28
-
-
Save Alirezaies/4948297a1c6e82d23186a7fccf464dbc to your computer and use it in GitHub Desktop.
Get The Latest Activity Of A User In Github
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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