From 47f7c71b1b68505e7a0c72c4302224058f7ddc49 Mon Sep 17 00:00:00 2001 From: Adam Coddington Date: Fri, 11 Oct 2013 18:10:19 -0700 Subject: [PATCH] Should an instance key not be returned, generate a UUID instead. Fixes #9. --- pyicloud/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyicloud/base.py b/pyicloud/base.py index c7becd5..e700c73 100644 --- a/pyicloud/base.py +++ b/pyicloud/base.py @@ -63,7 +63,7 @@ class PyiCloudService(object): if 'dsInfo' in resp: dsid = resp['dsInfo']['dsid'] self.params.update({'dsid': dsid}) - instance = resp['instance'] + instance = resp.get('instance', uuid.uuid4().hex) sha = hashlib.sha1(self.user.get('apple_id') + instance) self.params.update({'id': sha.hexdigest().upper()})