Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pygithub put file #1

Open
qgbcs opened this issue Jun 24, 2022 · 3 comments
Open

pygithub put file #1

qgbcs opened this issue Jun 24, 2022 · 3 comments

Comments

@qgbcs
Copy link
Owner

qgbcs commented Jun 24, 2022


ipdb> s
--Call--
> /usr/local/lib/python3.9/site-packages/requests/sessions.py(592)put()
    590         return self.request('POST', url, data=data, json=json, **kwargs)
    591 
--> 592     def put(self, url, data=None, **kwargs):
    593         r"""Sends a PUT request. Returns :class:`Response` object.
    594 

ipdb> !(self, url, data,kwargs)
(<requests.sessions.Session object at 0x7fd3cc05e220>, 'https://api.github.com:443/repos/qgbcs/kp/contents/2022-06-24__11.05.04__.110.txt', '{"message": "add new file", "content": "ZGF0YQ==", "branch": "master"}', {'headers': {'Authorization': 'token ============', 'User-Agent': 'PyGithub/Python', 'Content-Type': 'application/json'}, 'timeout': 15, 'verify': True, 'allow_redirects': False})
@qgbcs
Copy link
Owner Author

qgbcs commented Jun 25, 2022

同一个文件 上传两次

<Response [422]>

{'message': 'Invalid request.\n\n"sha" wasn\'t supplied.', 'documentation_url': 'https://docs.github.com/rest/reference/repos#create-or-update-file-contents'}

@qgbcs
Copy link
Owner Author

qgbcs commented Jun 25, 2022

In [141]: f
Out[141]: '/home/klk/v/.git/refs/heads/master'

In [142]: ll -al {f}
-rw-rw-r-- 1 klk 41 Mar 25 00:56 /home/klk/v/.git/refs/heads/master

In [143]: F.read_byte f
--------> F.read_byte(f)
Out[143]: b'234820a25edef263f18db9b9e3778ff012dd6ea1\n'

In [144]: git.github_upload(f)
Out[144]: <Response [422]>

In [145]: r
Out[145]: <Response [422]>

In [146]: print(r.json()['message'])
path contains a malformed path component

{'message': 'path contains a malformed path component',
 'errors': [{'resource': 'Commit', 'field': 'path', 'code': 'invalid'}],
 'documentation_url': 'https://docs.github.com/rest/reference/repos#create-or-update-file-contents'}

@qgbcs
Copy link
Owner Author

qgbcs commented Jun 27, 2022

连续发送大约9千个 请求

Out[254]: <Response [403]>

In [255]: print(_.json()['message'])
API rate limit exceeded for user ID 36606669.


In [257]: n,f
Out[257]: 
(9257,
 '/home/klk/.local/lib/python3.6/site-packages/twisted/enterprise/adbapi.py')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant