search

Home  >  Q&A  >  body text

python - qt客户端有实现这样的功能的库函数吗?

qt客户端有实现这样的功能的库函数吗?

########## File related
class UploadLinkView(APIView):

    def get(self, request, repo_id, format=None):
        if check_permission(repo_id, request.user.username) != 'rw':
            return api_error(status.HTTP_403_FORBIDDEN, "Can not access repo")

        if check_quota(repo_id) < 0:
            return api_error(HTTP_520_OPERATION_FAILED, 'Above quota')

        token = seafile_api.get_fileserver_access_token(
            repo_id, 'dummy', 'upload', request.user.username)
        url = gen_file_upload_url(token, 'upload-api')
        return Response(url)
        
        
        

qt客户端请求api,返回一个json字符串,字符串内容为一个url地址,qt客户端再去请求这个url地址。
这是文件上传功能,返回的url地址是监听8082端口的c服务。

PHPzPHPz2891 days ago391

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 09:15:09

    Although I don’t understand Python, Qt/C++ and pyQt support the Internet.
    Add the .pro file of the Qt project: QT += network
    If you use C++, add the .h file:

    #include <QNetworkAccessManager>  //网络访问管理
    #include <QNetworkProxy>  //(可选)网络代理
    #include <QNetworkReply>  //接收网络响应
    #include <QNetworkRequest>  //发送网络请求

    See Qt Network 5.7 in detail

    reply
    0
  • ringa_lee

    ringa_lee2017-04-18 09:15:09

    QT has its own network library, and QT5 has QNetworkAccessManager,QT4貌似有QHttpthat you can use. The official documentation for this kind of thing is very clear. .

    reply
    0
  • Cancelreply