fake_traffic
Imitating an Internet user by mimicking popular web traffic (internet traffic generator).
Install
pip install -U fake_traffic
⚠️ When FakeTraffic runs for the first time, playwright dowloads the chromium browser under the hood, which takes some time.
CLI version
fake_traffic -h
CLI examples:
# user located in Turkey, who speaks Kurdish and is interested in hot stories
fake_traffic -c tr -l ku-tr -ca h
# user located in Brazil, who speaks Portuguese and is interested in sports
fake_traffic -c br -l pt-br -ca s
# save logs into 'fake_traffic.log'
fake_traffic -c ru -l ru-ru -ca s -lf
# define wait times between requests
fake_traffic -c fr -l fr-fr -ca b -min_w 1 -max_w 100 -lf
# use none-headless mode
fake_traffic -c en -l en-us -ca t -nh -lf
Simple usage
from fake_traffic import FakeTraffic
FakeTraffic(country='US', language='en-US").crawl()
Advanced usage
from fake_traffic import FakeTraffic
ft = FakeTraffic(country='US', language='en-US', category='h', min_wait=1, max_wait=5, headless=True)
""" Imitating an Internet user by mimicking popular web traffic (internet traffic generator).
country = country code ISO 3166-1 Alpha-2 code (https://www.iso.org/obp/ui/),
language = country-language code ISO-639 and ISO-3166 (https://www.fincher.org/Utilities/CountryLanguageList.shtml),
category = сategory of interest of a user (defaults to 'h'):
'all' (all), 'b' (business), 'e' (entertainment),
'm' (health), 's' (sports), 't' (sci/tech), 'h' (top stories);
min_wait = minimal delay between requests (defaults to 1),
max_wait = maximum delay between requests (defaults to 10),
headless = True/False (defaults to True).
"""
ft.crawl()
Example
Mimic traffic of a user located in Turkey, who speaks Kurdish and is interested in hot stories
Find Turkey country code (ISO 3166-1 Alpha-2 code):
- country = "TR"
Find Turkey country-language code (ISO-639 and ISO-3166):
- english "en-TR",
- kurdish "ku-TR",
- turkish "tr-TR".
Set the category ('h', because the user in the example is interested in hot stories):
- category = 'h'
Starting in none-headless mode:
- headless=False
from fake_traffic import FakeTraffic
ft = FakeTraffic(country="TR", language="ku-TR", category='h', headless=False)
ft.crawl()
P.S. you can select language from other country. For example, such combinations are also correct:
FakeTraffic(country="TR", language="ar-TR").crawl()
FakeTraffic(country="US", language="he-IL").crawl()
FakeTraffic(country="DE", language="hi-IN").crawl()
Other examples
| Country | Language | Function |
|---|---|---|
| France | French | FakeTraffic(country="FR", language="fr-FR") |
| Germany | German | FakeTraffic(country="DE", language="de-DE", category='b') |
| India | English | FakeTraffic(country="IN", language="en-IN", category='all') |
| India | Hindi | FakeTraffic(country="IN", language="hi-IN", max_wait=10) |
| Russia | English | FakeTraffic(country="RU", language="en-US", category='b', headless=False) |
| Russia | Russian | FakeTraffic(country="RU", language="ru-RU", min_wait=0.5, max_wait=3) |
| Brazil | Portuguese | FakeTraffic(country="BR", language="pt-BR", category='s', threads=2, max_wait=60) |
| United Kingdom | English | FakeTraffic(country="GB", language="en-GB") |
| United States | English | FakeTraffic(country="US", language="en-US", min_wait=60, max_wait=300) |
| United States | Hebrew Israel | FakeTraffic(country="US", language="he-IL") |
Metadata
Release files for fake-traffic 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fake_traffic-2.0.0.tar.gz | 6.8 kB | Without provenance | Details for fake_traffic-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fake_traffic-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for fake_traffic-2.0.0-py3-none-any.whl |
Total release size: 14.6 kB
Release files / fake_traffic-2.0.0.tar.gz
| Download URL | fake_traffic-2.0.0.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff545edb11949c37a08a76fe5f524b7146517bc36d3314536eb50120f095bcc7
|
|
BLAKE2b-256 checksum How to use checksums |
5bb0610b7c00259adbd445434ac8cb4bae781da98650efe090be8270aaac662f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / fake_traffic-2.0.0-py3-none-any.whl
| Download URL | fake_traffic-2.0.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9059fbd9d0d2fb0cfd0f36961ec1187f3cc68824ae3be642f910c0bc4af65274
|
|
BLAKE2b-256 checksum How to use checksums |
d38e728c9e2b00169c4bf717e1ed89ab0063a6c43399592bcd45dff4632664c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Security for fake-traffic 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.