GitHub的V3 API - 删除/删除回购 [英] github v3 API - delete / remove a repo

查看:318
本文介绍了GitHub的V3 API - 删除/删除回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式删除一个GitHub库,我的应用程序建立一个单元测试环境的时候。

I would like to programmatically delete a github repo, when setting up a unit test environment for my application.

我已经使用第3版API,这似乎是最支持和路径前进。我使用下面的Python行成功创建回购,就好了:

I am already using the v3 API, which seems to be most supported and the path going forward. I am using the following python lines to successfully CREATE a repo, just fine:

import urllib2, base64
createData = '{\"name\": \"UnitTest-SubModules\", \"description\": \"This is a Fake repo used for testing\"}'
request = urllib2.Request("https://api.github.com/user/repos")
base64string = base64.encodestring('%s:%s' % ('user', 'pass')).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request, data=createData)

我如何设置此删除一个回购?我找不到规范在 http://developer.github.com/v3/repos/

我已经试过了,根据关guestimating,下面code,因为它遵循的API模式,但没有奏效。带回来urllib2.HTTPError:HTTP错误404:未找到

I have tried, based off guestimating, the following code, as it follows the API pattern, but it did not work. Came back with urllib2.HTTPError: HTTP Error 404: Not Found

request = urllib2.Request("https://api.github.com/repos/nyeates/UnitTest-SubModules")
base64string = base64.encodestring('%s:%s' % ('user', 'pass')).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
request.get_method = lambda: 'DELETE'
result = urllib2.urlopen(request)

我得到了蟒蛇HTTP从删除code:如何要使用HTTP的urllib2 DELETE方法?

推荐答案

Delete方法现在在这里:的 http://developer.github.com/v3/repos/#delete-a-repository

The DELETE method is now here: http://developer.github.com/v3/repos/#delete-a-repository

这篇关于GitHub的V3 API - 删除/删除回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆