本文整理汇总了Python中models.Client.create方法的典型用法代码示例。如果您正苦于以下问题:Python Client.create方法的具体用法?Python Client.create怎么用?Python Client.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Client
的用法示例。
在下文中一共展示了Client.create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: announce
# 需要导入模块: from models import Client [as 别名]
# 或者: from models.Client import create [as 别名]
def announce(request):
try:
params = torUtils.getParams(request.get_full_path()) # <-- Add this to models
ih = params[u'info_hash'][0]
# Match params to grab a specific torrent
t = Torrent.getTorrent(info_hash=ih)
# Check whether this is a new or returning client
c = t.getPeer(ip=request.META["REMOTE_ADDR"])
if c.size == 0:
c = Client.create(n = params['name'], i = request.META["REMOTE_ADDR"], p = params['port'], ih = params[u'info_hash'][0])
else:
# Parse old client
c = c[0]
c.update(params["event"])
except Exception as e:
print "Torrent not found; ", e
# return HttpResponse("Newp!")
# Match client against list of known users
# -- Seeding:
# -- Leeching:
# -- Loading:
# -- Inactive:
# If no announce, double-check peer connections, and send a new list
return HttpResponse("Fixthis")