File: ping.py

package info (click to toggle)
python-elasticsearch 9.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 22,728 kB
  • sloc: python: 104,053; makefile: 151; javascript: 75
file content (34 lines) | stat: -rw-r--r-- 802 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information

import random
import urllib3
import time


endpoints = [
    "http://app:9292/",
    "http://app:9292/ingest",
    "http://app:9292/search/mario",
    "http://app:9292/search/sonic",
    "http://app:9292/search/donkeykong",
    "http://app:9292/search/bubsy",
    "http://app:9292/delete",
    "http://app:9292/update",
    "http://app:9292/error",
]


def main():
    http = urllib3.PoolManager()
    while True:
        url = random.choice(endpoints)
        try:
            http.request("GET", url, preload_content=True)
        except Exception:
            pass
        time.sleep(1)


main()