mathsman5133 / coc.py

Python API Wrapper for Clash of Clans.
https://cocpy.readthedocs.io/en/latest/
MIT License
123 stars 41 forks source link

multiple clients login #142

Closed TAMILVIP007 closed 1 year ago

TAMILVIP007 commented 1 year ago

is there any way to login multiple mail id under same client class?

doluk commented 1 year ago

Yes and no. You have the option to specify the number of used keys, if you initalize the client. key_count can be up to 10 per email. What happens under the hood is, that coc.py fetches the keys from developer.clashofclans.com, checks them if they are useable (for the correct ip address) and (re-)creates, if needed, key(s).

So no, you can't login directly with multiple emails for one client. But you can use keys to login if you use login_with_keys() instead of login() and pass more than 10 keys. You can either get them manually, or iterate through your emails by create a client, login with an email, get the keys (client.http._keys), store them, logout and login with the next email... . Afterwards you create your final client with the key list and the login_with_keys() method.

TAMILVIP007 commented 1 year ago

Hmm keys you mean authorisation tokens ryt?. But there is no option to specify several ips there

doluk commented 1 year ago

yes tokens = keys, why would you need several ips? Your script/bot/application can only have one?

TAMILVIP007 commented 1 year ago

No heroku.com (an vps provider) changes ip on every restart.

doluk commented 1 year ago

coc.py will create a new key in that event. It can handle dynamical ip changes for one email account.

TAMILVIP007 commented 1 year ago

Cool then thanks