Skip to content

Added Twilio Voice Call feature #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b6a32e8
feat: adding django-postgres sample application
nehagup Sep 28, 2023
3453600
fix: removed the docker part from readme (#5)
Shashwat79802 Oct 19, 2023
73af76f
feat: adding new sample app for python (#7)
Shashwat79802 Oct 24, 2023
a4f811e
feat: application description added to the master readme
Shashwat79802 Oct 28, 2023
fc9acbd
feat: adding new python sample app
Shashwat79802 Nov 14, 2023
d854abb
Merge pull request #8 from Shashwat79802/main
Sonichigo Nov 16, 2023
0bd58eb
fix: updated requirements file, docker-compose config
Shashwat79802 Dec 12, 2023
d619dbc
Merge branch 'keploy:main' into main
Shashwat79802 Dec 12, 2023
0ad9d40
Merge pull request #9 from Shashwat79802/main
PranshuSrivastava Dec 12, 2023
b467f10
feat: added new requirements & changed port to 5432 (#11)
prajwalpd7 Jan 30, 2024
fe09284
fix: app running command
Sonichigo Feb 9, 2024
66c2ffd
feat: added missing steps (#10)
Sonichigo Feb 9, 2024
6426975
fix: app running command (#12)
Sonichigo Feb 9, 2024
5503b0b
fix: docker and readme instruction
Sonichigo Mar 4, 2024
b14963d
Merge branch 'main' into fastapi-readme
Sonichigo Mar 4, 2024
f05aab2
fix: docker and readme instruction
Sonichigo Mar 4, 2024
086b7a9
Merge pull request #16 from keploy/fastapi-readme
Sarthak160 Mar 7, 2024
3ba7e7c
Added Flask+MongoDB app with Unit tests, Postman testcases, Keploy te…
Swpn0neel Jun 14, 2024
c4fc91e
feat: revert for the workflow (#21)
Sonichigo Jun 14, 2024
fb38369
refactor: changes revert in flask-mongo (#22)
Sonichigo Jun 14, 2024
7e0e92e
Updated README (#20)
Swpn0neel Jun 18, 2024
d3f8140
fix: fastapi with docker compose (#15)
Guruprasanna02 Jul 26, 2024
9bdfbd8
add coverage guide and refacator flask and fastapi apps (#25)
Sonichigo Aug 4, 2024
181110e
refactor: remove keployFlaskMiddleware (#27)
Sarthak160 Aug 4, 2024
b043a93
added sanic+mongo sample app (#23)
Swpn0neel Aug 8, 2024
442f9e2
feat: created a sample app using flask and redis (#26)
Aman172003 Aug 8, 2024
1bd6f6e
chore: remove test folder (#28)
Sonichigo Sep 4, 2024
85d7561
feat:update unit test file in flask mongo (#29)
khareyash05 Sep 5, 2024
1234418
django-mongo sample app (#31)
AryanBakliwal Oct 24, 2024
aa1cafb
added sample app (#32)
Harshjosh361 Oct 28, 2024
28f4700
Feat: Add sample sanic-postgres app for the samples python repository…
slashexx Nov 20, 2024
20b388e
Bugfix/fastapi postgres (#34)
trivedi-khushi Dec 31, 2024
4868958
fix: docker compose cmd (#37)
Sonichigo Jan 1, 2025
4803633
chore: Update new slack url (#39)
Achanandhi-M May 11, 2025
c18373b
Added Twilio voice call feature using ngrok
drishlekh Jun 18, 2025
09b34fa
Added Twilio voice call feature using ngrok
drishlekh Jun 18, 2025
71faeda
Added Twilio voice call feature using ngrok
drishlekh Jun 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/License-Apache_2.0-blue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions .github/slack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion README

This file was deleted.

41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<h1 align="center"> Keploy Python Sample Applications </h1>
<p align="center">

<a href="CODE_OF_CONDUCT.md" alt="Contributions welcome">
<img src="https://img.shields.io/badge/Contributions-Welcome-brightgreen?logo=github" /></a>

<a href="https://join.slack.com/t/keploy/shared_invite/zt-357qqm9b5-PbZRVu3Yt2rJIa6ofrwWNg" alt="Slack">
<img src=".github/slack.svg" /></a>

<a href="https://opensource.org/licenses/Apache-2.0" alt="License">
<img src=".github/License-Apache_2.0-blue.svg" /></a>
</p>

This repo contains the samples for [Keploy's](https://keploy.io) integration with Python-based Application. Please feel free to contribute if you'd like submit a sample for another use-case or library.

> **Note** :- Issue Creation is disabled on this Repository, please visit [here](https://github.com/keploy/keploy/issues/new/choose) to submit Issue.

## Python Sample Apps with Keploy

1. [Flask-Mongo](https://github.com/keploy/samples-python/tree/main/flask-mongo) - This application is a simple task management API built using Python's Flask framework and MongoDB for data storage. It allows you to perform basic CRUD (Create, Read, Update, Delete) operations on student records. The API supports CORS (Cross-Origin Resource Sharing) to facilitate cross-domain requests.

2. [Django-Postgres](https://github.com/keploy/samples-python/tree/main/django-postgres) - This is an application to perform basic CRUD (Create, Read, Update, Delete) operations on user records built using Python's Django framework and PostgreSQL for data storage.

3. [FastAPI-Postgres](https://github.com/keploy/samples-python/tree/main/fastapi-postgres) - This application is a student management API built using Python's FastAPI and PostgreSQL for data storage. It allows you to perform basic CRUD (Create, Read, Update, Delete) operations on student data.

4. [FastAPI-Twilio](https://github.com/keploy/samples-python/tree/main/fastapi-twilio) - This application is a SMS sending API built using Python's FastAPI and Twilio for their SMS sharing service.

5. [Flask-Redis](https://github.com/keploy/samples-python/tree/main/flask-redis) - This Flask-based application provides a book management system utilizing Redis for caching and storage. It supports adding, retrieving, updating, and deleting book records, with optimized search functionality and cache management for improved performance. The API endpoints ensure efficient data handling and quick access to book information.

## Community Support ❤️

### 🤔 Questions?

Reach out to us. We're here to help!

[![Slack](https://img.shields.io/badge/Slack-4A154B?style=for-the-badge&logo=slack&logoColor=white)](https://join.slack.com/t/keploy/shared_invite/zt-357qqm9b5-PbZRVu3Yt2rJIa6ofrwWNg)
[![LinkedIn](https://img.shields.io/badge/linkedin-%230077B5.svg?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/company/keploy/)
[![YouTube](https://img.shields.io/badge/YouTube-%23FF0000.svg?style=for-the-badge&logo=YouTube&logoColor=white)](https://www.youtube.com/channel/UC6OTg7F4o0WkmNtSoob34lg)
[![Twitter](https://img.shields.io/badge/Twitter-%231DA1F2.svg?style=for-the-badge&logo=Twitter&logoColor=white)](https://twitter.com/Keployio)

### 💖 Let's Build Together!
92 changes: 92 additions & 0 deletions django-mongo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Inventory Management Application

## Overview

A simple Django + MongoDB inventory management application using mongoengine and Django REST Framework to test Keploy integration capabilities using Django and MongoDB.
The endpoints available will be:

1. `GET /api/items/` - List all items
2. `POST /api/items/` - Create a new item
3. `GET /api/items/<id>/` - Retrieve an item by ID
4. `PUT /api/items/<id>/` - Update an item by ID
5. `DELETE /api/items/<id>/` - Delete an item by ID

## Requirements

- Python 3.x
- Django
- mongoengine
- djangorestframework

## Setup Instructions

1. Clone the repository and navigate to project directory.
```bash
git clone https://github.com/keploy/samples-python.git
cd samples-python/django-mongo/django_mongo
```
2. Install Keploy.
```bash
curl --silent -O -L https://keploy.io/install.sh && source install.sh
```
3. Start MongoDB instance.
```bash
docker pull mongo
docker run --name mongodb -d -p 27017:27017 -v mongo_data:/data/db -e MONGO_INITDB_ROOT_USERNAME=<username> -e MONGO_INITDB_ROOT_PASSWORD=<password> mongo
```
4. Set up Django appllication.
```bash
python3 -m virtualenv venv
source venv/bin/activate
pip3 install -r requirements.txt
```
5. Capture the testcases.
```bash
keploy record -c "python3 manage.py runserver"
```
6. Generate testcases by making API calls.
```bash
# List items
# GET /api/items/
curl -X GET http://localhost:8000/api/items/
```
```bash
# Create Item
# POST /api/items/
curl -X POST http://localhost:8000/api/items/ \
-H "Content-Type: application/json" \
-d '{
"name": "Gadget C",
"quantity": 200,
"description": "A versatile gadget with numerous features."
}'
```
```bash
# Retrieve Item
# GET /api/items/<id>/
curl -X GET http://localhost:8000/api/items/<id>/
```
```bash
# Update Item
# PUT /api/items/<id>/
curl -X PUT http://localhost:8000/api/items/6142d21e122bda15f6f87b1d/ \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Widget A",
"quantity": 120,
"description": "An updated description for Widget A."
}'
```
```bash
# Delete Item
# DELETE /api/items/<id>/
curl -X DELETE http://localhost:8000/api/items/<id>/
```
Replace `<id>` with the actual ID of the item you want to retrieve, update, or delete.

## Run the testcases

Shut down MongoDB, Keploy doesn't need it during tests.
```bash
keploy test -c "python3 manage.py runserver" --delay 10
```
Empty file.
16 changes: 16 additions & 0 deletions django-mongo/django_mongo/django_mongo/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for django_mongo project.

It exposes the ASGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_mongo.settings')

application = get_asgi_application()
148 changes: 148 additions & 0 deletions django-mongo/django_mongo/django_mongo/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
"""
Django settings for django_mongo project.

Generated by 'django-admin startproject' using Django 5.1.2.

For more information on this file, see
https://docs.djangoproject.com/en/5.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.1/ref/settings/
"""

from pathlib import Path
import mongoengine

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-3g@-x5(3t(i(p^qnu9lz3hk1u1yobrvwz($5^ucvnn0a6b$%ob'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'inventory',
]

REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.AllowAny',
],
}

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'django_mongo.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'django_mongo.wsgi.application'


# Database
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases

# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': BASE_DIR / 'db.sqlite3',
# }
# }


# Password validation
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/5.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

# MongoDB configuration
MONGO_DB_NAME = 'inventory_db'
MONGO_USER = 'admin'
MONGO_PASSWORD = 'admin'
MONGO_HOST = 'localhost'
MONGO_PORT = 27017

# Connect to MongoDB
mongoengine.connect(
db=MONGO_DB_NAME,
username=MONGO_USER,
password=MONGO_PASSWORD,
host=MONGO_HOST,
port=MONGO_PORT
)
23 changes: 23 additions & 0 deletions django-mongo/django_mongo/django_mongo/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
URL configuration for django_mongo project.

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include

urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('inventory.urls')),
]
16 changes: 16 additions & 0 deletions django-mongo/django_mongo/django_mongo/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for django_mongo project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/5.1/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_mongo.settings')

application = get_wsgi_application()
Empty file.
3 changes: 3 additions & 0 deletions django-mongo/django_mongo/inventory/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions django-mongo/django_mongo/inventory/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class InventoryConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'inventory'
Empty file.
7 changes: 7 additions & 0 deletions django-mongo/django_mongo/inventory/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.db import models
from mongoengine import Document, StringField, IntField

class Item(Document):
name = StringField(required=True)
quantity = IntField(required=True)
description = StringField()
Loading