Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tonghouqi opened this issue Nov 30, 2018 · 5 comments

Comments

@tonghouqi
Copy link

No description provided.

@sun1279
Copy link

sun1279 commented Jan 2, 2019

请问现在接口还可以用么

@tonghouqi
Copy link
Author

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

@sun1279
Copy link

sun1279 commented Jan 16, 2019

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

@tonghouqi
Copy link
Author

需要微博开发者认证的。我写了一个自动采取东方财经信息的。 其中的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
Copy link

imcda commented Aug 27, 2021

TypeError: 'HttpObject' object is not callable

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants