Skip to content
Permalink
Browse files

rewrite to use try/except python3 compat

  • Loading branch information
ragzilla committed Aug 31, 2019
1 parent 26f6c27 commit 142fe120c9824819c0cbe67e3826509d3d25722d
Showing with 8 additions and 4 deletions.
  1. +8 −4 ikea-ota-download.py
@@ -6,10 +6,14 @@

import os
import json
import urllib
import urllib.request
try:
from urllib.request import urlopen, urlretrieve
except ImportError:
from urllib2 import urlopen
from urllib import urlretrieve

f = urllib.request.urlopen("http://fw.ota.homesmart.ikea.net/feed/version_info.json")

f = urlopen("http://fw.ota.homesmart.ikea.net/feed/version_info.json")
data = f.read()

arr = json.loads(data)
@@ -27,7 +31,7 @@
path = '%s/%s' % (otapath, fname)

if not os.path.isfile(path):
urllib.request.urlretrieve(url, path)
urlretrieve(url, path)
print(path)
else:
print('%s already exists' % fname)

0 comments on commit 142fe12

Please sign in to comment.
You can’t perform that action at this time.