Welcome to the Flask Advanced Promo repository! This project provides a more advanced implementation of a promotional code generator using the Flask web framework. It includes enhanced features such as the ability to specify categories and the number of codes to generate.
The Flask Advanced Promo application allows users to generate promotional codes for specific categories of games and customize the number of codes generated. This more advanced setup provides flexibility and control over the promo code generation process.
- Generate promo codes for a specific category or all categories.
- Specify the number of promo codes to generate (up to a maximum limit).
- Provides detailed error handling and responses.
- Ideal for use cases requiring more control and customization.
/Flask/advanced_promo
/app.py
/README.md
- Clone the Repository:
git clone https://github.com/mamadceto/H-P-G-Api
- Navigate to the Project Directory:
cd flask/advanced_promo
- Install Dependencies:
pip install -r requirements.txt
- Run the Application:
python app.py
- Access the API:
Open your web browser or API client and go to
http://localhost:5000/generate
to generate promo codes.
-
GET
/generate
This endpoint generates promo codes based on the specified category and number of codes.
category
(optional): The category for which to generate promo codes (e.g.,train
,chain
,bike
,clone
). If not specified, generates codes for all categories.num
(optional): The number of promo codes to generate per category (default is 4, with a maximum of 20).
To generate 5 promo codes for the train
category, make a GET request to:
http://localhost:5000/generate?category=train&num=5
The response will be a JSON object containing the generated promo codes for the specified category or all categories, as well as the creator information:
{
"train": [
"promoCode1",
"promoCode2",
"promoCode3",
"promoCode4",
"promoCode5"
],
"chain": [
"promoCode6",
"promoCode7",
"promoCode8",
"promoCode9",
"promoCode10"
],
"bike": [
"promoCode11",
"promoCode12",
"promoCode13",
"promoCode14",
"promoCode15"
],
"clone": [
"promoCode16",
"promoCode17",
"promoCode18",
"promoCode19",
"promoCode20"
],
"Creator": "@mmdceto"
}
-
Number of Codes per Category: You can modify the maximum number of codes that can be generated per category by changing the
MAX_CODES
variable inapp.py
. -
Category Options: The available categories are predefined in the
get_app_data()
function inapp.py
.
Contributions are welcome! If you have suggestions or improvements, please submit a pull request or open an issue.
For any inquiries or feedback, please contact @mmdceto.