Created
December 6, 2020 07:55
-
-
Save wolfv/685166dbb83e1cf6c10e0fcf265fd87d to your computer and use it in GitHub Desktop.
Delete from Anaconda channel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
repodata = requests.get("http://conda.anaconda.org/robostack/osx-64/repodata.json") | |
repodata = repodata.json() | |
def delete_url(owner_login, key, repodata): | |
item = repodata["packages"][key] | |
package_name = item["name"] | |
version = item["version"] | |
basename = key | |
subdir = repodata["info"]["subdir"] | |
basename = f"{subdir}/{key}" | |
return f"https://api.anaconda.org/dist/{owner_login}/{package_name}/{version}/{basename}" | |
for pkg, item in repodata["packages"].items(): | |
if item["build_number"] == 3: | |
# print(item) | |
print(delete_url("robostack", pkg, repodata)) | |
token = '<INSERT TOKEN>' | |
res = requests.delete(delete_url("robostack", pkg, repodata), headers={'Authorization': 'token ' + token}) | |
print(res.status_code) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment