mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +00:00
upload_asset with data in memory (#1601)
* Expose upload from memory functionality * Upload from memory basic test * Test for custom file like object * Reorganized existing release tests * Remove docstrings & comments from tests * Modify logic * Explain why encode ignores its argument Fixes #1140
This commit is contained in:
@@ -447,6 +447,21 @@ class Requester:
|
||||
headers["Content-Length"] = str(os.path.getsize(input))
|
||||
return self.__requestEncode(cnx, verb, url, parameters, headers, input, encode)
|
||||
|
||||
def requestMemoryBlobAndCheck(
|
||||
self, verb, url, parameters, headers, file_like, cnx=None
|
||||
):
|
||||
# The expected signature of encode means that the argument is ignored.
|
||||
def encode(_):
|
||||
return headers["Content-Type"], file_like
|
||||
|
||||
if not cnx:
|
||||
cnx = self.__customConnection(url)
|
||||
return self.__check(
|
||||
*self.__requestEncode(
|
||||
cnx, verb, url, parameters, headers, file_like, encode
|
||||
)
|
||||
)
|
||||
|
||||
def __requestEncode(
|
||||
self, cnx, verb, url, parameters, requestHeaders, input, encode
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user