发布,尽管Youtube API返回错误

时间:2019-11-26 12:35:46

标签: youtube-api youtube-data-api youtube-javascript-api youtube-iframe-api

在失败的帖子中获取此错误。

from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import urllib

# Register the streaming http handlers with urllib
register_openers()

# Start the multipart/form-data encoding of the file "sample.png"

# headers contains the necessary Content-Type and Content-Length
# datagen is a generator object that yields the encoded parameters
datagen, headers = multipart_encode({"image": open("sample.png")})

request = urllib.request.Request("https://my_sample_api_url", datagen, headers)

request.add_header("Authorization", "Basic ***********")

print(urllib.request.urlopen(request).read())

尽管该帖子已发布。

0 个答案:

没有答案