developer-disk-image 0.0.1__tar.gz → 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: developer_disk_image
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Download DeveloperDiskImage ans Personalized images from GitHub
5
5
  Author-email: doronz88 <doron88@gmail.com>
6
6
  Maintainer-email: doronz88 <doron88@gmail.com>
@@ -19,6 +19,8 @@ Requires-Python: >=3.8
19
19
  Description-Content-Type: text/markdown
20
20
  Provides-Extra: test
21
21
 
22
+ [![Pypi version](https://img.shields.io/pypi/v/developer_disk_image.svg)](https://pypi.org/project/developer_disk_image/ "PyPi package")
23
+
22
24
  # Overview
23
25
 
24
26
  Store both types of Apple's DeveloperDiskImage files:
@@ -30,8 +32,8 @@ Store both types of Apple's DeveloperDiskImage files:
30
32
  - `BuildManifest.plist`
31
33
  - Trustcache
32
34
 
33
- The split of the new format is requires for OS* other then macOS then will have trouble mounting the original APFS image
34
- inside: `~/Library/Developer/DeveloperDiskImages`.
35
+ The split of the new format is requires for OS* other than macOS that will have trouble extracting the original APFS
36
+ image inside: `~/Library/Developer/DeveloperDiskImages`.
35
37
 
36
38
  # Python package
37
39
 
@@ -39,7 +41,7 @@ Additionally, this repo provides a python API for accessing this repository.
39
41
  You can install it as follows:
40
42
 
41
43
  ```shell
42
- python3 -m pip install developer_disk_image
44
+ python3 -m pip install -U developer_disk_image
43
45
  ```
44
46
 
45
47
  ## Example usage
@@ -1,3 +1,5 @@
1
+ [![Pypi version](https://img.shields.io/pypi/v/developer_disk_image.svg)](https://pypi.org/project/developer_disk_image/ "PyPi package")
2
+
1
3
  # Overview
2
4
 
3
5
  Store both types of Apple's DeveloperDiskImage files:
@@ -9,8 +11,8 @@ Store both types of Apple's DeveloperDiskImage files:
9
11
  - `BuildManifest.plist`
10
12
  - Trustcache
11
13
 
12
- The split of the new format is requires for OS* other then macOS then will have trouble mounting the original APFS image
13
- inside: `~/Library/Developer/DeveloperDiskImages`.
14
+ The split of the new format is requires for OS* other than macOS that will have trouble extracting the original APFS
15
+ image inside: `~/Library/Developer/DeveloperDiskImages`.
14
16
 
15
17
  # Python package
16
18
 
@@ -18,7 +20,7 @@ Additionally, this repo provides a python API for accessing this repository.
18
20
  You can install it as follows:
19
21
 
20
22
  ```shell
21
- python3 -m pip install developer_disk_image
23
+ python3 -m pip install -U developer_disk_image
22
24
  ```
23
25
 
24
26
  ## Example usage
@@ -0,0 +1,6 @@
1
+ class DeveloperDiskImageException(Exception):
2
+ pass
3
+
4
+
5
+ class GithubRateLimitExceededError(DeveloperDiskImageException):
6
+ pass
@@ -5,6 +5,8 @@ from typing import Mapping, Optional
5
5
 
6
6
  import requests
7
7
 
8
+ from developer_disk_image.exceptions import GithubRateLimitExceededError
9
+
8
10
  DEVELOPER_DISK_IMAGE_REPO_TREE_URL = \
9
11
  'https://api.github.com/repos/doronz88/DeveloperDiskImage/git/trees/main?recursive=true'
10
12
 
@@ -23,9 +25,9 @@ class PersonalizedImage:
23
25
 
24
26
 
25
27
  class DeveloperDiskImageRepository:
26
- @staticmethod
27
- def create() -> 'DeveloperDiskImageRepository':
28
- return DeveloperDiskImageRepository(json.loads(requests.get(DEVELOPER_DISK_IMAGE_REPO_TREE_URL).text)['tree'])
28
+ @classmethod
29
+ def create(cls) -> 'DeveloperDiskImageRepository':
30
+ return cls(cls._query(DEVELOPER_DISK_IMAGE_REPO_TREE_URL)['tree'])
29
31
 
30
32
  def __init__(self, tree: Mapping):
31
33
  self._path_urls = {}
@@ -52,4 +54,11 @@ class DeveloperDiskImageRepository:
52
54
  url = self._path_urls.get(path, {}).get('url')
53
55
  if url is None:
54
56
  return None
55
- return base64.b64decode(json.loads(requests.get(url).text)['content'])
57
+ return base64.b64decode(self._query(url)['content'])
58
+
59
+ @staticmethod
60
+ def _query(url: str) -> Mapping:
61
+ response = json.loads(requests.get(url).text)
62
+ if response.get('message', '').startswith('API rate limit exceeded'):
63
+ raise GithubRateLimitExceededError()
64
+ return response
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: developer-disk-image
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Download DeveloperDiskImage ans Personalized images from GitHub
5
5
  Author-email: doronz88 <doron88@gmail.com>
6
6
  Maintainer-email: doronz88 <doron88@gmail.com>
@@ -19,6 +19,8 @@ Requires-Python: >=3.8
19
19
  Description-Content-Type: text/markdown
20
20
  Provides-Extra: test
21
21
 
22
+ [![Pypi version](https://img.shields.io/pypi/v/developer_disk_image.svg)](https://pypi.org/project/developer_disk_image/ "PyPi package")
23
+
22
24
  # Overview
23
25
 
24
26
  Store both types of Apple's DeveloperDiskImage files:
@@ -30,8 +32,8 @@ Store both types of Apple's DeveloperDiskImage files:
30
32
  - `BuildManifest.plist`
31
33
  - Trustcache
32
34
 
33
- The split of the new format is requires for OS* other then macOS then will have trouble mounting the original APFS image
34
- inside: `~/Library/Developer/DeveloperDiskImages`.
35
+ The split of the new format is requires for OS* other than macOS that will have trouble extracting the original APFS
36
+ image inside: `~/Library/Developer/DeveloperDiskImages`.
35
37
 
36
38
  # Python package
37
39
 
@@ -39,7 +41,7 @@ Additionally, this repo provides a python API for accessing this repository.
39
41
  You can install it as follows:
40
42
 
41
43
  ```shell
42
- python3 -m pip install developer_disk_image
44
+ python3 -m pip install -U developer_disk_image
43
45
  ```
44
46
 
45
47
  ## Example usage
@@ -2,6 +2,7 @@ README.md
2
2
  pyproject.toml
3
3
  requirements.txt
4
4
  developer_disk_image/__init__.py
5
+ developer_disk_image/exceptions.py
5
6
  developer_disk_image/repo.py
6
7
  developer_disk_image.egg-info/PKG-INFO
7
8
  developer_disk_image.egg-info/SOURCES.txt
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "developer_disk_image"
3
- version = "0.0.1"
3
+ version = "0.0.2"
4
4
  description = "Download DeveloperDiskImage ans Personalized images from GitHub"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.8"
@@ -1,12 +1,17 @@
1
+ import pytest
2
+
3
+ from developer_disk_image.exceptions import GithubRateLimitExceededError
1
4
  from developer_disk_image.repo import DeveloperDiskImageRepository
2
5
 
3
6
 
7
+ @pytest.mark.xfail(raises=GithubRateLimitExceededError)
4
8
  def test_developer_disk_image():
5
9
  repo = DeveloperDiskImageRepository.create()
6
10
  assert repo.get_developer_disk_image('16.4') is not None
7
11
  assert repo.get_developer_disk_image('16.4aaaa') is None
8
12
 
9
13
 
14
+ @pytest.mark.xfail(raises=GithubRateLimitExceededError)
10
15
  def test_personalized_disk_image():
11
16
  repo = DeveloperDiskImageRepository.create()
12
17
  assert repo.get_personalized_disk_image() is not None