[![Python >= 3.9](https://img.shields.io/badge/python->=3.9-red.svg)](https://www.python.org/downloads/) [![](https://badgen.net/github/release/deedy5/fake_traffic)](https://github.com/deedy5/fake_traffic/releases) [![](https://badge.fury.io/py/fake-traffic.svg)](https://pypi.org/project/fake-traffic)
# fake_traffic
Internet traffic generator. Utilizes real-time google search trends by specified parameters.
---
### Install
```python3
pip install -U fake_traffic
```
Install chromium browser with dependencies
```python3
playwright install --with-deps chromium
```
---
### CLI version
```python3
fake_traffic -h
```
CLI examples:
```python3
# user located in Austria, who speaks German, using comma separated keywords.
fake_traffic -c at -l de-at -k "Olympiade, Medaille, Beste Leistung"
# user located in Turkey, who speaks Kurdish, using google trends.
fake_traffic -c tr -l ku-tr
# save logs into 'fake_traffic.log'
fake_traffic -c ru -l ru-ru -lf
# use none-headless mode
fake_traffic -c en -l en-us -nh
# limit the number of tabs in the browser to 2
fake_traffic -c en -l en-us -t 2
# add an random delay (30-120 seconds) between requests
fake_traffic -c en -l en-us -t 1 -dmin 30 -dmax 120
```
---
### Simple usage
```python3
from fake_traffic import FakeTraffic
FakeTraffic(country="US", language="en-US").crawl()
```
---
### Advanced usage
```python3
from fake_traffic import FakeTraffic
ft = FakeTraffic(country="US", language="en-US", category="h", headless=True)
"""Internet traffic generator. Utilizes real-time google search trends by specified parameters.
country (str): Country code ISO 3166-1 Alpha-2 code (https://www.iso.org/obp/ui/), Defaults to "US".
language (str): Country-language code ISO-639 and ISO-3166 (https://www.fincher.org/Utilities/CountryLanguageList.shtml). Defaults to "en-US".
keywords (str | None): Comma separated queries for Google searches. If not specified, Google trending is used. Defaults to None.
headless (bool): Whether to run the browser in headless mode. Defaults to True.
tabs (int): Limit the number of tabs in browser. Defaults to 3.
delay_min (float | None): Minimum delay between requests in seconds. Defaults to None.
delay_max (float | None): Maximum delay between requests in seconds. Defaults to None.
"""
ft.crawl()
```
---
### Example
Using realtime search trends of a user located in Turkey, who speaks Kurdish
Find Turkey country code ([ISO 3166-1 Alpha-2 code](https://www.iso.org/obp/ui/)):</br>
- country = "TR" </br>
Find Turkey country-language code ([ISO-639 and ISO-3166](https://www.fincher.org/Utilities/CountryLanguageList.shtml)): </br>
- english "en-TR", </br>
- kurdish "ku-TR", </br>
- turkish "tr-TR". </br>
Starting in none-headless mode:
- headless=False
```python3
from fake_traffic import FakeTraffic
ft = FakeTraffic(country="TR", language="ku-TR", keywords=None, headless=False)
ft.crawl()
```
P.S. you can select language from other country.
For example, such combinations are also correct:
```python3
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", keywords="Audi")` |
India | English | `FakeTraffic(country="IN", language="en-IN")` |
India | Hindi | `FakeTraffic(country="IN", language="hi-IN")` |
Russia | English | `FakeTraffic(country="RU", language="en-US", headless=False)` |
Russia | Russian | `FakeTraffic(country="RU", language="ru-RU")` |
Brazil | Portuguese | `FakeTraffic(country="BR", language="pt-BR")` |
United Kingdom | English | `FakeTraffic(country="GB", language="en-GB")` |
United States | English | `FakeTraffic(country="US", language="en-US", tabs=4)` |
United States | Hebrew Israel | `FakeTraffic(country="US", language="he-IL")` |
Raw data
{
"_id": null,
"home_page": null,
"name": "fake-traffic",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "python, traffic generator, fake traffic",
"author": "deedy5",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/25/a8/24ab0e7b1f60d6e390d3b62fbda08fe3def92dd4d313e49fb33391e154d7/fake_traffic-3.2.tar.gz",
"platform": null,
"description": "[![Python >= 3.9](https://img.shields.io/badge/python->=3.9-red.svg)](https://www.python.org/downloads/) [![](https://badgen.net/github/release/deedy5/fake_traffic)](https://github.com/deedy5/fake_traffic/releases) [![](https://badge.fury.io/py/fake-traffic.svg)](https://pypi.org/project/fake-traffic)\n# fake_traffic\nInternet traffic generator. Utilizes real-time google search trends by specified parameters.\n\n---\n### Install\n\n```python3\npip install -U fake_traffic\n```\nInstall chromium browser with dependencies\n```python3\nplaywright install --with-deps chromium\n```\n\n---\n### CLI version\n```python3\nfake_traffic -h\n```\nCLI examples:\n```python3\n# user located in Austria, who speaks German, using comma separated keywords.\nfake_traffic -c at -l de-at -k \"Olympiade, Medaille, Beste Leistung\"\n# user located in Turkey, who speaks Kurdish, using google trends.\nfake_traffic -c tr -l ku-tr\n# save logs into 'fake_traffic.log'\nfake_traffic -c ru -l ru-ru -lf\n# use none-headless mode\nfake_traffic -c en -l en-us -nh\n# limit the number of tabs in the browser to 2\nfake_traffic -c en -l en-us -t 2\n# add an random delay (30-120 seconds) between requests\nfake_traffic -c en -l en-us -t 1 -dmin 30 -dmax 120\n```\n---\n### Simple usage\n```python3\nfrom fake_traffic import FakeTraffic\n\nFakeTraffic(country=\"US\", language=\"en-US\").crawl()\n```\n---\n### Advanced usage\n```python3\nfrom fake_traffic import FakeTraffic\n\nft = FakeTraffic(country=\"US\", language=\"en-US\", category=\"h\", headless=True)\n \"\"\"Internet traffic generator. Utilizes real-time google search trends by specified parameters.\n country (str): Country code ISO 3166-1 Alpha-2 code (https://www.iso.org/obp/ui/), Defaults to \"US\".\n language (str): Country-language code ISO-639 and ISO-3166 (https://www.fincher.org/Utilities/CountryLanguageList.shtml). Defaults to \"en-US\".\n keywords (str | None): Comma separated queries for Google searches. If not specified, Google trending is used. Defaults to None.\n headless (bool): Whether to run the browser in headless mode. Defaults to True.\n tabs (int): Limit the number of tabs in browser. Defaults to 3.\n delay_min (float | None): Minimum delay between requests in seconds. Defaults to None.\n delay_max (float | None): Maximum delay between requests in seconds. Defaults to None.\n \"\"\"\n\nft.crawl()\n```\n---\n### Example\nUsing realtime search trends of a user located in Turkey, who speaks Kurdish\n\nFind Turkey country code ([ISO 3166-1 Alpha-2 code](https://www.iso.org/obp/ui/)):</br>\n - country = \"TR\" </br>\n\nFind Turkey country-language code ([ISO-639 and ISO-3166](https://www.fincher.org/Utilities/CountryLanguageList.shtml)): </br>\n - english \"en-TR\", </br>\n - kurdish \"ku-TR\", </br>\n - turkish \"tr-TR\". </br>\n\nStarting in none-headless mode:\n - headless=False\n```python3\nfrom fake_traffic import FakeTraffic\n\nft = FakeTraffic(country=\"TR\", language=\"ku-TR\", keywords=None, headless=False)\nft.crawl()\n```\nP.S. you can select language from other country.\nFor example, such combinations are also correct:\n```python3\nFakeTraffic(country=\"TR\", language=\"ar-TR\").crawl()\nFakeTraffic(country=\"US\", language=\"he-IL\").crawl()\nFakeTraffic(country=\"DE\", language=\"hi-IN\").crawl()\n```\n---\n### Other examples\nCountry | Language | Function |\n----------|---------- | ---------------------------------------------|\nFrance | French | `FakeTraffic(country=\"FR\", language=\"fr-FR\")` |\nGermany | German | `FakeTraffic(country=\"DE\", language=\"de-DE\", keywords=\"Audi\")` |\nIndia | English | `FakeTraffic(country=\"IN\", language=\"en-IN\")` |\nIndia | Hindi | `FakeTraffic(country=\"IN\", language=\"hi-IN\")` |\nRussia | English | `FakeTraffic(country=\"RU\", language=\"en-US\", headless=False)` |\nRussia | Russian | `FakeTraffic(country=\"RU\", language=\"ru-RU\")` |\nBrazil | Portuguese | `FakeTraffic(country=\"BR\", language=\"pt-BR\")` |\nUnited Kingdom | English | `FakeTraffic(country=\"GB\", language=\"en-GB\")` |\nUnited States | English | `FakeTraffic(country=\"US\", language=\"en-US\", tabs=4)` |\nUnited States | Hebrew Israel | `FakeTraffic(country=\"US\", language=\"he-IL\")` |\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Internet traffic generator.",
"version": "3.2",
"project_urls": {
"Homepage": "https://github.com/deedy5/fake_traffic"
},
"split_keywords": [
"python",
" traffic generator",
" fake traffic"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1e3296b59e24474fef33852a55a790e6692e1065b81dfde5c1a48f65225d4e44",
"md5": "3055542a444c6da0e5f816f9181ca412",
"sha256": "6af9165b77d6ae8dd38b7059d27611b4d34bb1bb4a034fb1146cc75b28b449a8"
},
"downloads": -1,
"filename": "fake_traffic-3.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3055542a444c6da0e5f816f9181ca412",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 7413,
"upload_time": "2025-01-18T17:08:57",
"upload_time_iso_8601": "2025-01-18T17:08:57.990567Z",
"url": "https://files.pythonhosted.org/packages/1e/32/96b59e24474fef33852a55a790e6692e1065b81dfde5c1a48f65225d4e44/fake_traffic-3.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "25a824ab0e7b1f60d6e390d3b62fbda08fe3def92dd4d313e49fb33391e154d7",
"md5": "71008482055b8300e7738f11e2b6eccc",
"sha256": "39672c1976bbe5b555deae301e98a1a4b10a32d2a14619d823607a08594d9b32"
},
"downloads": -1,
"filename": "fake_traffic-3.2.tar.gz",
"has_sig": false,
"md5_digest": "71008482055b8300e7738f11e2b6eccc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 6059,
"upload_time": "2025-01-18T17:08:59",
"upload_time_iso_8601": "2025-01-18T17:08:59.539573Z",
"url": "https://files.pythonhosted.org/packages/25/a8/24ab0e7b1f60d6e390d3b62fbda08fe3def92dd4d313e49fb33391e154d7/fake_traffic-3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-18 17:08:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "deedy5",
"github_project": "fake_traffic",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "playwright",
"specs": [
[
">=",
"1.49.1"
]
]
}
],
"lcname": "fake-traffic"
}