Skip to content

Commit

Permalink
Made Python watch script support both compressed and non-compressed r…
Browse files Browse the repository at this point in the history
…esponses
  • Loading branch information
bastianeicher committed Sep 25, 2024
1 parent fe2c336 commit c25f383
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion python/windows-arm64.watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
import gzip, re
from datetime import datetime

data = gzip.decompress(request.urlopen('https://www.python.org/downloads/windows/').read()).decode('utf-8')
bytes = request.urlopen('https://www.python.org/downloads/windows/').read()

# Response is sometimes, but not always, GZip-compressed
try: bytes = gzip.decompress(bytes)
except: pass

data = bytes.decode('utf-8')

releases = []
for match in re.findall(r'Python (3)\.([0-9]+)\.([0-9]+)([0-9abrc]+?) - (.*)<\/a>', data):
Expand Down
8 changes: 7 additions & 1 deletion python/windows.watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
import gzip, re
from datetime import datetime

data = gzip.decompress(request.urlopen('https://www.python.org/downloads/windows/').read()).decode('utf-8')
bytes = request.urlopen('https://www.python.org/downloads/windows/').read()

# Response is sometimes, but not always, GZip-compressed
try: bytes = gzip.decompress(bytes)
except: pass

data = bytes.decode('utf-8')

releases = []
for match in re.findall(r'Python (3)\.([0-9]+)\.([0-9]+)([0-9abrc]+?) - (.*)<\/a>', data):
Expand Down

0 comments on commit c25f383

Please sign in to comment.