Skip to content

Commit ecc9d15

Browse files
committed
Added version 0.0.7 and updated README file
1 parent 921215e commit ecc9d15

3 files changed

Lines changed: 37 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Change log
22

3+
### 0.0.7
4+
- Fixed configuration issues
5+
- Fixed all the review comments
6+
- Refactor code
7+
- Removed unused code
8+
- Added local dev env using TDEI-local-server Package
9+
- Added local env support to -
10+
- Logger
11+
- Queue
12+
- Topic
13+
- Storage
14+
315
### 0.0.6
416
- Added get_remote_url function in FileEntity class which will return the uploaded file url
517

README.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ All the cloud connections are initialized with `initialize` function of core whi
2424
Eg.
2525
```python
2626
from python_ms_core import Core
27-
Core.initialize()
27+
core = Core() or Core(config='Local')
2828
```
2929
The method analyzes the `.env` variables and does a health check on what components are available
3030

@@ -56,12 +56,13 @@ This file will have to be generated or shared offline as per the developer requi
5656
Offers helper classes to help log the information. It is also used to record the audit messages
5757
as well as the analytics information required.
5858

59-
Use `Core.get_logger()`
59+
Use `core.get_logger()`
6060
Eg.
6161
```python
6262
from python_ms_core import Core
6363

64-
logger = Core.get_logger()
64+
core = Core()
65+
logger = core.get_logger()
6566

6667
# Record a metric
6768
logger.record_metric(name='test', value='test') # Metric and value
@@ -74,7 +75,8 @@ Eg.
7475
```python
7576
from python_ms_core import Core
7677

77-
logger = Core.get_logger()
78+
core = Core()
79+
logger = core.get_logger()
7880

7981
# Record a metric
8082
logger.debug('Debug Message')
@@ -102,15 +104,12 @@ The configuration required by Queue and Topic is similar and will be handled via
102104

103105
Topic can be accessed by the core method `get_topic`. This method takes two parameters
104106
1. topic name (required)
105-
2. callback function where messages will be received
106107

107108
```python
108109
from python_ms_core import Core
109110

110-
def callback(instance):
111-
print(instance.get_messages())
112-
113-
topic = Core.get_topic(topic_name='topicName', callback=callback)
111+
core = Core()
112+
topic = core.get_topic(topic_name='topicName')
114113

115114
```
116115

@@ -121,7 +120,8 @@ Once the topic object is got, use `publish` method to publish the message to top
121120
from python_ms_core import Core
122121
from python_ms_core.core.queue.models.queue_message import QueueMessage
123122

124-
topic = Core.get_topic(topic_name='topicName')
123+
core = Core()
124+
topic = core.get_topic(topic_name='topicName')
125125
topic.publish(QueueMessage.data_from(
126126
{
127127
'message': 'Test message'
@@ -139,18 +139,26 @@ It takes one parameter
139139
```python
140140
from python_ms_core import Core
141141

142-
topic = Core.get_topic(topic_name='topicName')
143-
msg = topic.subscribe(subscription='subscriptionName')
144-
print(msg)
142+
core = Core()
143+
topic_object = topic = Core.get_topic(topic_name='topicName')
144+
145+
def process(message):
146+
print(f'Message Received: {message}')
147+
148+
try:
149+
topic_object.subscribe(subscription='subscriptionName')
150+
except Exception as e:
151+
print(e)
145152
```
146153

147154
### Storage
148155
For all the azure blobs and other storages, storage components will offer simple ways to upload/download and read the existing data.
149156
```python
150157
from python_ms_core import Core
151158

159+
core = Core()
152160
# Create storage client
153-
azure_client = Core.get_storage_client()
161+
azure_client = core.get_storage_client()
154162

155163
# Get a container in the storage client
156164
container = azure_client.get_container(container_name='tdei-storage-test')
@@ -168,7 +176,8 @@ File upload is done only through read stream.
168176
from python_ms_core import Core
169177
from io import BytesIO, StringIO
170178

171-
azure_client = Core.get_storage_client()
179+
core = Core()
180+
azure_client = core.get_storage_client()
172181
container = azure_client.get_container(container_name='tdei-storage-test')
173182
# Create an instance of `AzureFileEntity` with name and mime-type
174183
txt = 'foo\nbar\nbaz'

freeze_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
build_date = date.today().strftime('%Y-%m-%d')
1313

14-
version = '0.0.6'
14+
version = '0.0.7'
1515

1616
with open(version_file_path, 'w+') as version_file:
1717
version_file.write("version = '{}'\n".format(version))

0 commit comments

Comments
 (0)