Created
September 18, 2017 20:40
-
-
Save opragel/a6be01c03e0acaba7407623c62472b63 to your computer and use it in GitHub Desktop.
google_drive_sync_update_checker.py
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/python | |
import xml.etree.ElementTree as ET | |
import requests | |
import uuid | |
params = {'cup2hreq': 'foo', 'cup2key': 'bar'} | |
platform = 'mac' | |
os_version = '10.12' | |
xml = """ | |
<request protocol="3.0" requestid="{%s}"> | |
<os platform="%s" version="%s" /> | |
<app appid="com.google.GoogleDrive" lang="en-us"> | |
<updatecheck /> | |
</app> | |
</request> | |
""" % (str(uuid.uuid1()), platform, os_version) | |
r = requests.post('https://tools.google.com/service/update2', params=params, data=xml) | |
root = ET.fromstring(r.text) | |
dmg_url_list = [] | |
version_list = [] | |
for tag in root.iter('url'): | |
dmg_url_list.append(tag.attrib['codebase']) | |
break | |
for tag in root.iter('manifest'): | |
version_list.append(tag.attrib['version']) | |
for tag in root.iter('package'): | |
dmg_url_list.append(tag.attrib['name']) | |
dmg_url = ''.join(dmg_url_list) | |
version = ''.join(version_list) | |
print dmg_url | |
print version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Original good bits taken from: https://gist.github.com/bruienne/1c8f7dd37cdf4f2ff544ee3a7b163fbf