 
                        curl命令如下:
C:\Users\yingfang>curl -v -H "Content-Type:application/json" -X POST -d "emails=
2&path=/新儒家美学论衡.png&s_type=f"  -u 1@qq.com:1 http://192.168.17.2:8000/rep
os/da3072ba-66ef-4c7f-87c7-c5f189d9c2b2/dir/share结果截图如下:

结果如下

请求的服务器程序为(python写的):
class DirShareView(APIView):
authentication_classes = (TokenAuthentication, )
permission_classes = (IsAuthenticated,)
throttle_classes = (UserRateThrottle, )
# from seahub.share.view::gen_private_file_share
def post(self, request, repo_id, format=None):
    emails = request.POST.getlist('emails', '')
    s_type = request.POST.get('s_type', '')
    path = request.POST.get('path', '')
    perm = request.POST.get('perm', 'r')
    file_or_dir = os.path.basename(path.rstrip('/'))
    username = request.user.username
    for email in [e.strip() for e in emails if e.strip()]:
        if not is_registered_user(email):
            continue
        if s_type == 'f':
            pfds = PrivateFileDirShare.objects.add_read_only_priv_file_share(
                username, email, repo_id, path)
        elif s_type == 'd':
            pfds = PrivateFileDirShare.objects.add_private_dir_share(
                username, email, repo_id, path, perm)
        else:
            continue
        # send a signal when sharing file successful
        share_file_to_user_successful.send(sender=None, priv_share_obj=pfds)
    return HttpResponse(json.dumps({"message:share success"}), status=200, content_type=json_content_type)
curl命令的结果是这样,是怎么回事
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
认证高级PHP讲师