擅长:python、mysql、java
<p>您正在寻找的API端点是<a href="https://telegra.ph/api#createAccount" rel="nofollow noreferrer">createAccount</a>。调用此端点将返回包含accesstoken的对象</p>
<p>从文档中:</p>
<blockquote>
<p>On success, returns an Account object with the regular fields and an additional <code>access_token</code> field.</p>
</blockquote>
<p>话虽如此,您提到的库使使用api更加容易。您甚至不需要明确地知道<code>access_token</code>。您只需要调用<code>.create_account()</code>,库将在内部管理令牌(<a href="https://github.com/python273/telegraph/blob/df18a3db6165dfad915e5b89768ad7d269c11961/telegraph/api.py#L82" rel="nofollow noreferrer">see here</a>和<a href="https://github.com/python273/telegraph/blob/df18a3db6165dfad915e5b89768ad7d269c11961/telegraph/api.py#L26" rel="nofollow noreferrer">here</a>以了解如何操作)</p>
<p>下面是一个示例代码,介绍如何使用lib创建帐户并利用它:</p>
<pre><code>
from telegraph import Telegraph
telegraph = Telegraph()
acc = telegraph.create_account(short_name='1337')
print(acc)
response = telegraph.create_page(
'Hey',
html_content='<p>Hello, world!</p>',
)
</code></pre>