Clickstream Faker Provider for Python.
Project description
Clickstream Faker Provider for Python
Purpose
This is a custom Faker provider for Python that generates clickstream session data. Data generated from this provider
represent user clickstream sessions on an online e-commerce site that sells mobile phones.
Installation
The Clickstream Faker Provider for Python is available to install from PyPi using pip.
pip install faker_clickstream
Usage
Sample code of Clickstream Provider usage.
from faker import Faker
from faker_clickstream import ClickstreamProvider
fake = Faker()
fake.add_provider(ClickstreamProvider)
fake.session_clickstream()
# or...
fake.session_clickstream(rand_session_max_size=50) # random number of events from 1 to 50
The session_clickstream() method returns an array of JSON objects that represents a unique web session. By default, is
configured to return a random number of session events from the range of 1 through 25.
An example response object is the below:
[
{
"ip": "85.59.39.221",
"user_id": 777198,
"user_agent": "Mozilla/5.0 (iPad; CPU OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) CriOS/45.0.2454.68 Mobile/11D257 Safari/9537.53",
"session_id": "d5cba274f7724780d1ed2b60650101892260748df21b0e2fb8b2b2fd88cedf23",
"event_time": "28/03/2022 23:09:48.360212",
"event_name": "AddToCart",
"channel": "Social media",
"metadata": {
"product_id": 162012,
"quantity": 1
}
},
{
"ip": "85.59.39.221",
"user_id": 777198,
"user_agent": "Mozilla/5.0 (iPad; CPU OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) CriOS/45.0.2454.68 Mobile/11D257 Safari/9537.53",
"session_id": "d5cba274f7724780d1ed2b60650101892260748df21b0e2fb8b2b2fd88cedf23",
"event_time": "28/03/2022 23:14:13.360227",
"event_name": "AddToCart",
"channel": "Social media",
"metadata": {
"product_id": 464710,
"quantity": 2
}
},
{
"ip": "85.59.39.221",
"user_id": 777198,
"user_agent": "Mozilla/5.0 (iPad; CPU OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) CriOS/45.0.2454.68 Mobile/11D257 Safari/9537.53",
"session_id": "d5cba274f7724780d1ed2b60650101892260748df21b0e2fb8b2b2fd88cedf23",
"event_time": "28/03/2022 23:17:49.360241",
"event_name": "Checkout",
"channel": "Social media",
"metadata": {}
},
{
"ip": "85.59.39.221",
"user_id": 777198,
"user_agent": "Mozilla/5.0 (iPad; CPU OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) CriOS/45.0.2454.68 Mobile/11D257 Safari/9537.53",
"session_id": "d5cba274f7724780d1ed2b60650101892260748df21b0e2fb8b2b2fd88cedf23",
"event_time": "28/03/2022 23:22:15.360252",
"event_name": "Search",
"channel": "Social media",
"metadata": {
"query": "Samsung"
}
}
]
Features
Each user session includes some static data that are randomly calculated only once, such as the ip, user_agent, etc.
The events that are available on this clickstream are the following ones, and an event dependency has been configured to provide a more real representation of a web session flow:
SearchAddToCartDeleteFromCart(depends onAddToCartevent)IncreaseQuantityDecreaseQuantity(depends onIncreaseQuantityevent)AddPromoCode(depends onCheckoutevent)Checkout(depends onAddToCartevent)LoginLogout(depends onLoginevent)CheckoutAsGuestCompleteOrder(depends on any ofCheckoutorCheckoutAsGuestevents)CheckOrderStatus(depends onLoginevent)
Moreover, the Search, AddToCart, IncreaseQuantity DeleteFromCart & CheckOrderStatus include a metadata field
with additional information about the products and the user queries.
Contributing
Feel free to support this project and contribute! Support this project by giving a star!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file faker_clickstream-0.1.1.tar.gz.
File metadata
- Download URL: faker_clickstream-0.1.1.tar.gz
- Upload date:
- Size: 59.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61353ba60565dbbbbbeb1761b33ed614bbc783fe4829aece6a56bb6fb66f84b0
|
|
| MD5 |
3c245828d36b3c503027120f9d1a5ff8
|
|
| BLAKE2b-256 |
3e46a610949ecc2b0a32a08c8e779eefb8fce239782da1d94861ff3d20dc436c
|
File details
Details for the file faker_clickstream-0.1.1-py3-none-any.whl.
File metadata
- Download URL: faker_clickstream-0.1.1-py3-none-any.whl
- Upload date:
- Size: 60.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07d55b83611bf9af2d1209bf482d45d30458ab9ba7c733dcac7a6c43f30ea1f4
|
|
| MD5 |
0e36ae9714dcb8e237ade772ebd4f3e2
|
|
| BLAKE2b-256 |
45c50471f55d24e59d37036b3805b22c05a625efde4ccca177659e7e158eec1d
|