Skip to main content

Internet traffic generator.

Project description

Python >= 3.8

fake_traffic

Internet traffic generator. Utilizes real-time google search trends by specified parameters.


Install

pip install -U fake_traffic

Install chromium browser with dependencies

playwright install --with-deps chromium

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
# save logs into 'fake_traffic.log'
fake_traffic -c ru -l ru-ru -ca s -lf
# use none-headless mode
fake_traffic -c en -l en-us -ca t -nh

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', headless=True)
    """Internet traffic generator. Utilizes real-time google search trends by specified parameters.
    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);
    headless = True/False (defaults to True).
    """
ft.crawl()

Example

Using realtime search trends 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")
Russia English FakeTraffic(country="RU", language="en-US", category='b', headless=False)
Russia Russian FakeTraffic(country="RU", language="ru-RU")
Brazil Portuguese FakeTraffic(country="BR", language="pt-BR", category='s')
United Kingdom English FakeTraffic(country="GB", language="en-GB")
United States English FakeTraffic(country="US", language="en-US")
United States Hebrew Israel FakeTraffic(country="US", language="he-IL")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fake_traffic-2.1.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

fake_traffic-2.1.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file fake_traffic-2.1.1.tar.gz.

File metadata

  • Download URL: fake_traffic-2.1.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for fake_traffic-2.1.1.tar.gz
Algorithm Hash digest
SHA256 6ee8ce00253cf39cc768b4782e8d1f36ee8e92e2bbcc2b2386c716088b6bdeb6
MD5 189b3777a18a78bddc05a1cb52b89bd1
BLAKE2b-256 a67f9215ceca8e0ddb74b2650f98df1103119a22ceaf67db9254281c1e498431

See more details on using hashes here.

File details

Details for the file fake_traffic-2.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fake_traffic-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e34eaff9b5770318a54582cfff36dddd9d108cbc1d8563e960f9013e4a0b0bd0
MD5 38ad6d83b424af92b3a447b84611fc8b
BLAKE2b-256 8ec5a458a25d619ce12fcdcad203cdad8fa88c66826086709e00cd7631aad907

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page