Skip to content

Commit 2a12c57

Browse files
authored
Update event-hubs-capture-python.md
datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Replaced with datetime.datetime.now(datetime.UTC).
1 parent 74a6b19 commit 2a12c57

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

articles/event-hubs/event-hubs-capture-python.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ In this section, you create a Python script that sends 200 events (10 devices *
7272
event_data_batch = producer.create_batch() # Create a batch. You will add events to the batch later.
7373
for dev in devices:
7474
# Create a dummy reading.
75-
reading = {'id': dev, 'timestamp': str(datetime.datetime.utcnow()), 'uv': random.random(), 'temperature': random.randint(70, 100), 'humidity': random.randint(70, 100)}
75+
reading = {'id': dev, 'timestamp': str(datetime.datetime.now(datetime.UTC)), 'uv': random.random(), 'temperature': random.randint(70, 100), 'humidity': random.randint(70, 100)}
7676
s = json.dumps(reading) # Convert the reading into a JSON string.
7777
event_data_batch.add(EventData(s)) # Add event data to the batch.
7878
producer.send_batch(event_data_batch) # Send the batch of events to the event hub.

0 commit comments

Comments
 (0)