10/04/18 01:32:47
わかりました。
処理は正しく、Twitter の OAuth 認証に登録したアプリが無効化されていました。
新しいアプリをもう一つ登録し、そちらで試したらあっさり動きました。
無効化されたアプリを再度有効化するには api@twitter.com にメールするみたい。
以下、Twitter から届いていたメール。
> This is a notice that your OAuth token for あんたのアプリケーション has
> been suspended from interacting with the Twitter API.
>
> Please make sure that your application follows Twitter's policies, including
> the Twitter rules (URLリンク(help.twitter.com)),
> the API rules (URLリンク(twitter.jp)), and the automation rules
> (URLリンク(help.twitter.com)).
>
> To request for your token to be re-enabled, please write to api@twitter.com
Status: 401 Unauthorized
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<request>/oauth/request_token</request>
<error>Invalid / suspended application</error>
</hash>
というレスポンス通り、suspended application だったわけで。
お恥ずかしい限りです。