2

我正在尝试将 github API 与 python 一起使用,但在想要分叉一个 repo 时被卡住了。到目前为止,我的脚本是:

#!/usr/bin/python
import json
import getpass
from restkit import Resource, BasicAuth, request
from socketpool import ConnectionPool

user= raw_input( "Github user:" )

password=getpass.getpass()
auth=BasicAuth(user, password)

authreqdata = { "scopes": [ "public_repo" ], "note": "admin script" }

resource = Resource('https://api.github.com/authorizations', filters=[auth])
response = resource.post(headers={ "Content-Type": "application/json" },         payload=json.dumps(authreqdata))
token = json.loads(response.body_string())['token']

print token

我得到了安全令牌,但在尝试分叉回购时惨遭失败。

你能帮我解决这个问题吗?

提前致谢!

4

0 回答 0