本文整理汇总了Python中handler.Handler.add_video方法的典型用法代码示例。如果您正苦于以下问题:Python Handler.add_video方法的具体用法?Python Handler.add_video怎么用?Python Handler.add_video使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类handler.Handler
的用法示例。
在下文中一共展示了Handler.add_video方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: from handler import Handler [as 别名]
# 或者: from handler.Handler import add_video [as 别名]
def start(req):
form = util.FieldStorage(req)
directory = 'YOUR_SAVE_FILE_DIRECTORY'
api_key = 'YOUR_API_KEY'
username = form.getfirst('user')
if not username:
raise InputDataIncorrect('Specify the username with the \'user\' GET attribute.')
handling = Handler(directory, api_key, username, 50)
handling.add_to_watched(form.getfirst('watched'))
handling.add_video(form.getfirst('add_video'))
handling.save()
req.write(handling.build_html())
if not form.getfirst('watched'):
handling.update_videos()
req.write('Refresh the page to see new videos.')
示例2: InputDataIncorrect
# 需要导入模块: from handler import Handler [as 别名]
# 或者: from handler.Handler import add_video [as 别名]
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import cgi
import cgitb
import sys
from handler import Handler
from fetcher import InputDataIncorrect
cgitb.enable()
directory = "YOUR_SAVE_FILE_DIRECTORY"
api_key = "YOUR_API_KEY"
form = cgi.FieldStorage()
username = form.getvalue("user")
if not username:
raise InputDataIncorrect("Specify the username with the 'user' GET attribute.")
handling = Handler(directory, api_key, username, 50)
handling.add_to_watched(form.getvalue("watched"))
handling.add_video(form.getvalue("add_video"))
handling.save()
xmlstr = handling.build_html()
f = sys.stdout
f.write("Content-type:text/html\r\n\r\n")
f.write("<!DOCTYPE html>")
f.write(xmlstr)
if not form.getvalue("watched"):
handling.update_videos()
print "Refresh the page to see new videos."