Skip to main content

Huds regularly used utilities

Project description

Sure! Here is the complete README.md content that you can copy all at once:

# HudUtils

Regularly used utils.

## Installation

```bash
pip install hudutils

Usage

Flatten JSON

from hudutils import hudutils

json_data = {
    "a": 1,
    "b": {
        "c": 2,
        "d": {
            "e": 3
        }
    }
}

flattened = hudutils.flatten_json(json_data)
print(flattened)

Filename with Rollover

from hudutils import hudutils

filename = 'log.txt'
new_filename = hudutils.filename_with_rollover(filename, opts=['year', 'month', 'day'])
print(new_filename)

Elasticsearch Data Fetcher

from hudutils import ElasticsearchDataFetcher

# Assuming you have a config file named config.json
fetcher = ElasticsearchDataFetcher('config.json')

# Fetch data from Elasticsearch
data = fetcher.fetch_data('your_index')
print(data)

# Run a specific query
query_data = fetcher.run_query('your_index', 'your_query')
print(query_data)

# Send data to Elasticsearch
docs = [{'field': 'value'}, {'field': 'value2'}]
fetcher.send_to_elasticsearch(docs, 'your_index')

This updated README.md provides clear examples of how to use the flatten_json, filename_with_rollover, and ElasticsearchDataFetcher functionalities within the hudutils library.



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

hudutils-0.6.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hudutils-0.6-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file hudutils-0.6.tar.gz.

File metadata

  • Download URL: hudutils-0.6.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.8 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8

File hashes

Hashes for hudutils-0.6.tar.gz
Algorithm Hash digest
SHA256 139535bde926e9860fa013042df43e4ea149a9d3d1b6e8865feb21750f8c9186
MD5 6fbd8e3e035c5077e08229d79d7d7f08
BLAKE2b-256 ce2b217f0aba458f3fc57ea9fb6cf67a8e966e48e9f2bf4df2bc0b783594bb02

See more details on using hashes here.

File details

Details for the file hudutils-0.6-py3-none-any.whl.

File metadata

  • Download URL: hudutils-0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.8 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8

File hashes

Hashes for hudutils-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d186a7dc68cf5f5be4da8547f35e5fd647822f4b29782d75f4c72b3d65c2ec70
MD5 2d1e87e2fc901827c1d587d822673b98
BLAKE2b-256 8d67409ea12c39fee5674456f18823bfb44d4c0cb782165ce9cac9d40bccfa5d

See more details on using hashes here.

Supported by

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