使用python-requests-aws的“错误请求”

时间:2017-06-01 16:24:24

标签: python amazon-s3 python-requests

我正在尝试使用requests-aws包,如下所示:

In [1]: import requests

In [2]: from awsauth import S3Auth

然后,在定义ACCESS_KEYSECRET_KEY变量以及url之后,其中'http://mybuck.s3.amazonaws.com/file.txt'具有指定格式mybuckPUT替换为实际()),我尝试发出In [8]: r = requests.put(url, data=s, auth=S3Auth(ACCESS_KEY ...: , SECRET_KEY)) In [9]: r.ok Out[9]: False In [10]: r.reason Out[10]: 'Bad Request' 请求:

ChatHelper.getInstance().login(user, new QBEntityCallback<Void>() {
            @Override
            public void onSuccess(Void result, Bundle bundle) {
                if(progressDialog!=null)
                    progressDialog.dismiss();
                loginToChat();
                android.util.Log.e(TAG, "QB Chat Login successfully");
            }

            @Override
            public void onError(QBResponseException e) {
                android.util.Log.e(TAG, "Error Login in Home Screen>>>" +e);
                if(progressDialog!=null)
                    progressDialog.dismiss();

            }
        });



private void loginToChat() {
        if(SharedPrefsHelper.getInstance().getQbUser()!=null){
            final QBUser user = SharedPrefsHelper.getInstance().getQbUser();
            ChatHelper.getInstance().loginToChat(user, new QBEntityCallback<Void>() {
                @Override
                public void onSuccess(Void result, Bundle bundle) {
                    android.util.Log.v(TAG, "Chat login onSuccess()");

                }

                @Override
                public void onError(QBResponseException e) {

                    android.util.Log.w(TAG, "Chat login onError(): " + e);


                }
            });
        }
    }

然而,正如您所看到的,它被视为“错误请求”(状态代码400)。这里出了什么问题?

0 个答案:

没有答案