私は、LINE Messaging APIを使用して、ボットを介してメッセージをプッシュしようとしています。 https://business.line.me/en/に記載されている設定/設定に従い、このエラーが発生しました。このAPIへのアクセスは拒否されました。あなたのIPアドレス[23.3.104.4]はこのAPIにアクセスできません。LINE RESTful Messaging API - 間違ったIPアドレスのエラー
「。デベロッパーセンター内のIPホワイトリストにあなたのIPを追加します。しかし、私はすでに開発センター内のサーバーのホワイトリストに自分のIPアドレスを追加してください。 をIPがエラーで示されても、私のIPではありません。
def line_http(uri, req_body, accessToken, m='post'):
req_headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + accessToken
}
if m=='post':
result = urlfetch.post(url=uri,
payload=req_body,
headers=req_headers)
else:
result = urlfetch.get(url=uri,
payload=req_body,
headers=req_headers)
return result
resp = line_http('https://api.line.me/v1/profile', {},'xxxxxxxxxxx', 'get')
r = json.loads(resp.body)
pprint(r)
mid = r['mid']
req_body={'to':mid, 'messages':[{'type': 'text', 'text': "SPBotReport finished."}]}
jsonStr = json.dumps(req_body)
resp = line_http('https://api.line.me/v2/bot/message/push', jsonStr, 'xxxxxxxxxxx')
if resp.status == 200:
print("SPBotReport LINE text finished successfully.")
sys.exit()
else:
print("Status:%s, Reason:%s" % (resp.status, resp.reason))
if resp.headers["content-type"].find("json") > 0:
r = json.loads(resp.body)
print("message: %s" % r["message"])
使用している:以下はPythonコードの抜粋です。 VPNまたはシステムが動作するファイアウォールを設置する? –
これはバグで、修正されました。私は同じ問題を抱えており、今日は大丈夫です。 –