Skip to main content

Python DSL for setting up Flask app CDC

Project description

How to use

Install pip install avro-helper-devlibx

Quick example

from devlibx_avro_helper.month_data import MonthDataAvroHelper

base64Str = "BgY3LTMCBjYtNgIGNy01BAAAAAI="
helper = MonthDataAvroHelper()
result = helper.process(base64Str)
print(result)

# Result
# {'days': {'8-16': 110, '8-17': 111, '8-14': 108, '8-15': 109, '8-18': 112, '8-19': 113, '8-30': 124, '8-31': 125, '8-12': 106, '8-13': 107, '8-10': 104, '8-11': 105, '9-1': 126, '9-2': 127, '9-3': 128, '8-27': 121, '9-4': 129, '8-6': 100, '8-28': 122, '8-7': 101, '8-25': 119, '8-8': 102, '8-26': 120, '8-9': 103, '8-29': 123, '8-20': 114, '8-23': 117, '8-24': 118, '8-21': 115, '8-22': 116}, 'entity_id': 'harish_1'}

Get last N days data

In this example we would have data in base 64 encoding. We will get last 29 nad 7 days data from.

# How to use - the full example is given below
from devlibx_avro_helper.month_data import MonthDataAvroHelper

helper = MonthDataAvroHelper()
result = helper.process_and_return_last_n_days_from_time(date_time_obj, base64Str, 30)
from devlibx_avro_helper.month_data import MonthDataAvroHelper
from datetime import datetime


def test_collect_data_for_n_days(self):
    base64Str = "PAg3LTI1zgIINy0yNNACCDctMjfKAgg3LTI20AIINy0yOcQCCDctMjjQAgg3LTIxwAIINy0yMNACCDctMjO4Agg3LTIyxAIGOC0xygIGOC0yzgIGOC0zsAIGOC00wAIINy0xNM4CBjgtNcACCDctMTO8AgY4LTa6Agg3LTE2xAIGOC03xgIGNy05yAIINy0xNcICCDctMTjGAgg3LTE3ugIINy0xOc4CCDctMzC0Agg3LTEwwAIINy0zMboCCDctMTLQAgg3LTExvgIAAAAC"

    date_time_str = '07/08/22 01:55:19'
    date_time_obj = datetime.strptime(date_time_str, '%d/%m/%y %H:%M:%S')
    
    helper = MonthDataAvroHelper()
    result = helper.process_and_return_last_n_days_from_time(date_time_obj, base64Str, 30)
    self.assertEqual(30, len(result))
    print("result of test_collect_data_for_n_days 30 days", result)
    
    result = helper.process_and_return_last_n_days_from_time(date_time_obj, base64Str, 7)
    self.assertEqual(7, len(result))
    print("result of test_collect_data_for_n_days 7 days", result)

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

avro-helper-devlibx-0.0.7.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

avro_helper_devlibx-0.0.7-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file avro-helper-devlibx-0.0.7.tar.gz.

File metadata

  • Download URL: avro-helper-devlibx-0.0.7.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for avro-helper-devlibx-0.0.7.tar.gz
Algorithm Hash digest
SHA256 c1ca60558f48e4e8699b1a2a2d88fe17706f0d6aef6b0d47b00755bc37fdec21
MD5 684b9a5ec784a46d9c77d6a9f30933f8
BLAKE2b-256 8fcb5d7820f7ec817d509220f9f2660fab4daa0fe603e5435d8bb71de85254a3

See more details on using hashes here.

File details

Details for the file avro_helper_devlibx-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for avro_helper_devlibx-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 047d69f17d0dc9ce3c47555a34f749f87d5c1f30d98e21eb84886189a176b089
MD5 4f906d948c7ea1a57e493d3ab7ffe3c2
BLAKE2b-256 71c5875f34d266bc59dac7f3afd19a50d67cae6dcacd7b931f087ff34dac154f

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