Results 1 to 4 of 4

Thread: Remove IP restriction for creating an API key

  1. #1

    Remove IP restriction for creating an API key

    I don't understand the concept of creating an API key that allows requests from only one IP address. We have 3 clans and I am trying to create a bot that gives the CWL stats of our family clans. I would like to host this on a heroku server where the IP address will not be the same for each request. Moreover, I am always getting this error message whenever I create an API key using my machine's IP address: IP address must not be in private IP address range. I tried to create a key using different ISPs, but all are giving me the same error.

    If we could make use of our in game API token for this purpose, it would be much helpful. An another suggestion is to limit the number of requests per account per day, if we are using the free version of the COC API (Charge gems or money if we exceed 10 requests per day. I will pay happily). Please consider these things, thank you

  2. #2
    Hi your IP address should be the external IP for your machine. You can find this using https://whatismyipaddress.com/ or an api service such as https://api.ipify.org/. While heroku is not recommended for a variety of reasons (mainly the site is not designed for hosting bots), you can get around the dynamic IP by making some requests to the dev site with appropriate creds. If using python, I can suggest using coc.py (https://github.com/mathsman5133/coc.py), which does this for you.
    Last edited by mathsman5132; January 6th, 2020 at 07:33 AM.

  3. #3
    Hey would you go about allowing a request from localhost:8000?

  4. #4
    Forum Elder Colin94's Avatar
    Join Date
    Aug 2016
    Location
    Germany
    Posts
    2,172
    You can rent a cheap vps if you don't have an external IP. Either run your bot or your own web server with API on the VPS or use it to tunnel the traffic.

    Edit: Maybe this link helps with your heroku IP. I have no idea whether heroku has a static external IP or not tho. https://stackoverflow.com/questions/...oku-dynos?rq=1
    Last edited by Colin94; January 17th, 2020 at 09:43 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •