8000 Add the "delete" method to the Asset class. · borgstrom/github3.py@56c0fff · GitHub
[go: up one dir, main page]

Skip to content

Commit 56c0fff

Browse files
committed
Add the "delete" method to the Asset class.
1 parent 0f301b2 commit 56c0fff

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

github3/repos/release.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ def upload_asset(self, content_type, name, asset):
153153

154154

155155
class Asset(GitHubCore):
156+
157+
CUSTOM_HEADERS = {'Accept': 'application/vnd.github.manifold-preview'}
158+
156159
def _update_attributes(self, asset):
157160
self._api = asset.get('url')
158161
#: Content-Type provided when the asset was created
@@ -211,6 +214,19 @@ def download(self, path=''):
211214
return True
212215
return False
213216

217+
@requires_auth
218+
def delete(self):
219+
"""Users with push access to the repository can delete an asset.
220+
221+
:returns: True if successful; False if not successful
222+
"""
223+
url = self._api
224+
return self._boolean(
225+
self._delete(url, headers=Asset.CUSTOM_HEADERS),
226+
204,
227+
404
228+
)
229+
214230
def edit(self, name, label=None):
215231
"""Edit this asset.
216232

0 commit comments

Comments
 (0)
0