小编Дми*_*нко的帖子

使用 python 请求获取 eBay 访问令牌(交换身份验证令牌)

我正在尝试使用本指南来获取访问令牌。

这是我的主文件:

import requests

from utils import make_basic_auth_header, conf
code = '<Auth code here>'
url = "%s/identity/v1/oauth2/token" % conf('EBAY_API_PREFIX')
headers = {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Authorization': make_basic_auth_header()
    }

data = {
    'grant_type': 'authorization_code',
    # 'grant_type': 'refresh_token',
    'state': None,
    'code': code,
    'redirect_uri': conf('EBAY_RUNAME')
}
r = requests.post(
    url,
    data=data,
    headers=headers,
)
Run Code Online (Sandbox Code Playgroud)

这是make_basic_auth_header()函数:

def make_basic_auth_header():
    auth_header_payload = '%s:%s' % (conf('EBAY_APP_ID'), conf('EBAY_CERT_ID'))
    auth_header_base64 = base64.b64encode(auth_header_payload)
    auth_header = 'Basic %s' % auth_header_base64
    return auth_header
Run Code Online (Sandbox Code Playgroud)

但我得到的r.json()只是:

{u'error_description': u'request is missing …
Run Code Online (Sandbox Code Playgroud)

python oauth-2.0 python-2.7 python-requests ebay-api

5
推荐指数
1
解决办法
1165
查看次数

如何旋转表格单元格中的文本?

我正在尝试制作这样的表格:

具有垂直标题单元格的表格

如您所见,标题是垂直方向的。如何使用 python-docx 实现此目的?

PS 抱歉未翻译表格。

python-docx

4
推荐指数
1
解决办法
2037
查看次数