LINE RESTful Messaging API - Error with wrong IP address
<p>I am using LINE Messaging API trying to push a message via bot. I've followed the configuration/setup detailed in <a href="https://business.line.me/en/" rel="nofollow">https://business.line.me/en/</a> and encountered this error - Access to this API denied due to the following reason: Your ip address [23.3.104.4] is not allowed to access this API. Please add your IP to the IP whitelist in the developer center."</p>

<p>But I already added my ip to the Server Whitelist in the developer center.
The IP indicated in the error is not even my ip.</p>

<p>Below is snippet of python code:</p>

<pre><code>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") &gt; 0:
            r = json.loads(resp.body)
            print("message: %s" % r["message"])
</code></pre>

<p>I think that might be a bug and caused of "Server IP Whitelist" in your bot settings.
Try to remove the ip address you assigned.</p>

python line