Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. def getGithubVersion(addonpage):
  2. try:
  3. response = requests.get(addonpage)
  4. response.raise_for_status() # Raise an exception for HTTP errors
  5. content = str(response.content)
  6. #match = re.search(r'<div class="commit-sha-group">\\n<div class="label label-monospace">\\n(?P<hash>[^<]+?)\\n</div>', content)
  7. match = re.search(r'<include-fragment src="/(.+)/(.+)/tree-commit/(?P<hash>[^<]+?)" class="commit-tease commit-loader">', content)
  8. result = ''
  9. if match:
  10. result = match.group('hash')
  11. return result.strip()
  12. except Exception as err:
  13. print('Failed to find version number for: ' + addonpage)
  14. print(err)
  15. return ''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement