How to make trial period for my python application?
You need a web server and a database to get this working.
- Create a licenses table in your database.
- Each time a new client pays for your software or asks for a trial, you generate a new long random license, insert it in the licenses table, associate it to the client's email address and send it to the client via email.
- Each time a client tries to install the software on their computers, you ask for a license and contact the webserver to ensure that the license exists and is still valid.
Using that, people can still just create multiple emails and thus potentially get an infinite amount of trial versions.
You can then try to add a file somewhere in the person's computer, a place where nobody would ever look for, and just paste the old license there so that when the app starts again (even from a new installation), it can read the license from there and contact the webserver without asking for a license. With this method, when your app contacts the server with an expired trial license, your server can reply with a "license expired" signal to let your app know that it has to ask for a non-trial license now, and the server should only accept non-trial licenses coming from that app from now on. This whole method breaks if your clients realize that your app is taking this information from a local file because they can just delete it when found.
Another idea that comes to mind is to associate the MAC address of a laptop (or any other unique identifier you can think of) to one license instead of an email address, either at license-creation time (the client would need to send you his MAC address when asking for a trial) or at installation time (your app can check for the MAC address of the laptop it's running on).
1) you can hardcode in app timestamp after witch it will stop working and check on each run if this timestamp greater then time.time(). This approach will work if you have one customer or few customers and able to make trial version with different dates for each of them.
2) use platform/sdk for licence like https://cryptolens.io/ or other
3) write you own solution, maybe How to generate and validate a software license key? will help you