We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
使用SDK中的方法去获取access_token,服务器返回Bad Request,有谁知道是哪里有问题吗?
代码如下: import urllib2 import urllib from snspy import APIClient from snspy import SinaWeiboMixin
def wbAPItest(): client = APIClient(SinaWeiboMixin, app_key=appkey, app_secret=appsec, redirect_uri=redirurl) url = client.get_authorize_url() r = client.request_access_token(authcode) access_token = r.access_token # access token,e.g., abc123xyz456 expires = r.expires
if name=='main': httpHandler = urllib2.HTTPHandler(debuglevel=1) httpsHandler = urllib2.HTTPSHandler(debuglevel=1) opener = urllib2.build_opener(httpHandler, httpsHandler) urllib2.install_opener(opener) wbAPItest()
运行后日志: ERROR:root:POST: https://api.weibo.com/oauth2/access_token send: 'POST /oauth2/access_token HTTP/1.1\r\nContent-Length: 204\r\nAccept-Encoding: gzip\r\nConnection: close\r\nUser-Agent: Python-urllib/2.7\r\nHost: api.weibo.com\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nclient_secret=b6745a6318f713f8f00b8d715927fab5&code=b0d87cc1e249a30626b82549376d830e&grant_type=authorization_code&client_id=2066080083&redirect_uri=http%3A//open.weibo.com/apps/2066080083/privilege/oauth'
reply: 'HTTP/1.1 400 Bad Request\r\n' header: Server: nginx/1.6.1
header: Date: Tue, 19 May 2015 08:47:05 GMT
header: Transfer-Encoding: chunked
header: Connection: close
header: Pragma: No-cache
header: Cache-Control: no-cache
header: Expires: Thu, 01 Jan 1970 00:00:00 GMT
header: Api-Server-IP: 10.75.25.115
The text was updated successfully, but these errors were encountered:
我也遇到同样的为题,解决了吗
Sorry, something went wrong.
No branches or pull requests
使用SDK中的方法去获取access_token,服务器返回Bad Request,有谁知道是哪里有问题吗?
代码如下:
import urllib2
import urllib
from snspy import APIClient
from snspy import SinaWeiboMixin
def wbAPItest():
client = APIClient(SinaWeiboMixin, app_key=appkey, app_secret=appsec, redirect_uri=redirurl)
url = client.get_authorize_url()
r = client.request_access_token(authcode)
access_token = r.access_token # access token,e.g., abc123xyz456
expires = r.expires
if name=='main':
httpHandler = urllib2.HTTPHandler(debuglevel=1)
httpsHandler = urllib2.HTTPSHandler(debuglevel=1)
opener = urllib2.build_opener(httpHandler, httpsHandler)
urllib2.install_opener(opener)
wbAPItest()
运行后日志:
ERROR:root:POST: https://api.weibo.com/oauth2/access_token
send: 'POST /oauth2/access_token HTTP/1.1\r\nContent-Length: 204\r\nAccept-Encoding: gzip\r\nConnection: close\r\nUser-Agent: Python-urllib/2.7\r\nHost: api.weibo.com\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nclient_secret=b6745a6318f713f8f00b8d715927fab5&code=b0d87cc1e249a30626b82549376d830e&grant_type=authorization_code&client_id=2066080083&redirect_uri=http%3A//open.weibo.com/apps/2066080083/privilege/oauth'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Server: nginx/1.6.1
header: Date: Tue, 19 May 2015 08:47:05 GMT
header: Transfer-Encoding: chunked
header: Connection: close
header: Pragma: No-cache
header: Cache-Control: no-cache
header: Expires: Thu, 01 Jan 1970 00:00:00 GMT
header: Api-Server-IP: 10.75.25.115
The text was updated successfully, but these errors were encountered: