Skip to content

Instantly share code, notes, and snippets.

@uilianries
Created April 11, 2019 13:12
Show Gist options
  • Save uilianries/2af1f288ec2c90ca0287cf34b12fbefe to your computer and use it in GitHub Desktop.
Save uilianries/2af1f288ec2c90ca0287cf34b12fbefe to your computer and use it in GitHub Desktop.
Delete Bintray file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import os
from requests.auth import HTTPBasicAuth
bintray_api = "https://api.bintray.com/"
package_id = "0ab9fcf606068d4347207cc29edd400ceccbc944"
channel = "testing"
library = "hello"
version = "1.0"
username = "bincrafters"
reference = "{username}/{library}/{version}/{channel}".format(username=username, library=library, version=version, channel=channel)
#reference = "{library}/{version}/{channel}".format(username=username, library=library, version=version, channel=channel)
#reference = "{library}:{username}/{version}:{channel}".format(username=username, library=library, version=version, channel=channel)
file_path = "{reference}/0/package/{package_id}/0/conanmanifest.txt".format(package_id=package_id, reference=reference)
url = "/content/{subject}/{repo}/{file_path}".format(subject="bincrafters", repo="public-conan", file_path=file_path)
print(url)
username = os.environ["BINTRAY_LOGIN_USERNAME"]
password = os.environ["BINTRAY_PASSWORD"]
address = bintray_api + url
print("ADDRESS: %s" % address)
r = requests.delete(address, auth=HTTPBasicAuth(username, password))
print(r.content, r.status_code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment