MCPcopy Create free account
hub / github.com/LOLINTERNETZ/vscodeoffline / check_for_update

Method check_for_update

vscoffline/sync.py:63–99  ·  view source on GitHub ↗
(self, old_commit_id=None)

Source from the content-addressed store, hash-verified

61 self.checkedForUpdate = False
62
63 def check_for_update(self, old_commit_id=None):
64 if not old_commit_id:
65 # To trigger the API to delta
66 old_commit_id = '7c4205b5c6e52a53b81c69d2b2dc8a627abaa0ba'
67
68 url = vsc.URL_BINUPDATES + \
69 f"{self.identity}/{self.quality}/{old_commit_id}"
70
71 log.debug(f'Update url {url}')
72 result = requests.get(url, allow_redirects=True, timeout=vsc.TIMEOUT)
73 self.checkedForUpdate = True
74
75 if result.status_code == 204:
76 # No update available
77 return False
78 elif result.status_code != 200:
79 # Unhandled response from API
80 log.warning(
81 f"Update url failed {url}. Unhandled status code {result.status_code}")
82 return False
83
84 jresult = result.json()
85
86 self.updateurl = jresult['url']
87 self.name = jresult['name']
88 self.version = jresult['version']
89 self.productVersion = jresult['productVersion']
90 self.hash = jresult['hash']
91 self.timestamp = jresult['timestamp']
92 self.sha256hash = jresult['sha256hash']
93
94 if 'supportsFastUpdate' in jresult:
95 self.supportsFastUpdate = jresult['supportsFastUpdate']
96 if self.updateurl:
97 return True
98 else:
99 return False
100
101 def download_update(self, destination):
102 if not self.checkedForUpdate:

Callers 1

latest_versionsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected