lxyu / weibo

Python sina weibo sdk. More simpler and cleaner than the official one.
http://lxyu.github.io/weibo/
236 stars 82 forks source link

上传一张图片是可以的,请问上传多张图片怎么处理呢? #20

Open tonghouqi opened 5 years ago

sun1279 commented 5 years ago

请问现在接口还可以用么

tonghouqi commented 5 years ago

接口可以用,不过需要修改一下。 我又整改的接口。 文字可以正常发微博,图片只能发一张,发布多张图片的问题我没解决。

sun1279 commented 5 years ago

能否贴几段示例代码?我使用一直提示没有权限。你的微博开发者认证了没?谢谢

tonghouqi commented 5 years ago

需要微博开发者认证的。我写了一个自动采取东方财经信息的。 其中的weibo2是我自己改了一下。

-- coding: utf-8 --

import requests import time from bs4 import BeautifulSoup from weibo2 import Client

API_KEY = '3633482137' API_SECRET = 'd137be69157b6014cdf39d0e0fc11d66' REDIRECT_URI = 'https://api.weibo.com/oauth2/default.html'

c = Client(API_KEY, API_SECRET, REDIRECT_URI, username='*', password='***')

获取东方财富的实时新闻

soup.find(id='livenews-list').find('livenews-media')

ids = [] count = 0 while True: dongfang = requests.get('http://kuaixun.eastmoney.com/')

print dongfang.text

soup = BeautifulSoup(dongfang.text, "lxml")
for item in soup.find(id='livenews-list').children:
    id = item.get('id')
    if not id in ids:
        starttime = item.find(class_ = 'time').text
        mediatitle = item.find(class_ = 'media-title').text
        href = item.find('a',href=True)
        hrefcont = ""
        if not href is None:
            hrefcont = u" " + href['href']
        if count != 0:
            weibotext = starttime + "  " + mediatitle + "  " + hrefcont
            if weibotext > 139:
                weibotext = starttime + mediatitle[0:135-len(hrefcont)]  + hrefcont
                c.post('statuses/share', status=weibotext)
                #print weibotext
        ids.append(id)

count = count + 1
if count == 30000:
    count = 1
time.sleep(10)
imcda commented 3 years ago

TypeError: 'HttpObject' object is not callable

在用Client.post()的时候出现这个报错,为什么?已经认证了