小编eri*_*ric的帖子

Python问题:AttributeError:'dict'对象没有属性'upper'

尝试发布推文时,我从AppEngine收到此错误.我觉得我的语法不对,但我现在不知所措.

对于我的生活,我似乎无法使用以下命令将我的状态参数发送到post函数中的**extra_params:

args = {} <br/>
args.update({'status': 'THIS IS MY TWEET'})<br/>
info2 = client.post('/statuses/update',args)<br/>
Run Code Online (Sandbox Code Playgroud)

确切的错误是:

"File "/base/data/home/apps/kymbatweet/1.350119792863170339/main.py", line 311, in get_signed_body
    __meth.upper(), __url, '&'.join(
AttributeError: 'dict' object has no attribute 'upper'"
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?(代码如下)

    def post(self, api_method, http_method='POST', expected_status=(200,), **extra_params):

        if not (api_method.startswith('http://') or api_method.startswith('https://')):
            api_method = '%s%s%s' % (
                self.service_info['default_api_prefix'], api_method,
                self.service_info['default_api_suffix']
                )

        if self.token is None:
            #self.token = OAuthAccessToken.get_by_key_name(self.get_cookie())
            self.token = "000"



        fetch = urlfetch(url=api_method, payload=self.get_signed_body(
            api_method, "000", http_method, **extra_params
            ), method=http_method)

        if fetch.status_code not in expected_status:
            raise ValueError(
                "Error …
Run Code Online (Sandbox Code Playgroud)

python twitter google-app-engine

2
推荐指数
1
解决办法
6953
查看次数

标签 统计

google-app-engine ×1

python ×1

twitter ×1