Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions ui_src/src/const/codeExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ func main() {
langCode: 'python',
installation: `pip3 install --upgrade memphis-py`,
producer: `from __future__ import annotations
import asyncio
import asyncio
from memphis import Memphis, Headers, MemphisError, MemphisConnectError, MemphisHeaderError, MemphisSchemaError

async def main():
try:
memphis = Memphis()
Expand All @@ -260,20 +260,20 @@ async def main():
headers = Headers()
headers.add("key", "value")
for i in range(5):
await producer.produce(bytearray('Message #'+str(i)+': Hello world', 'utf-8'), headers=headers)
await producer.produce(bytearray("Message #" + str(i) + ": Hello world", "utf-8"), headers=headers)

except (MemphisError, MemphisConnectError, MemphisHeaderError, MemphisSchemaError) as e:
print(e)

finally:
await memphis.close()

if __name__ == '__main__':
if __name__ == "__main__":
asyncio.run(main())`,
consumer: `from __future__ import annotations
import asyncio
import asyncio
from memphis import Memphis, MemphisError, MemphisConnectError, MemphisHeaderError

async def main():
async def msg_handler(msgs, error, context):
try:
Expand Down Expand Up @@ -303,7 +303,7 @@ async def main():
finally:
await memphis.close()

if __name__ == '__main__':
if __name__ == "__main__":
asyncio.run(main())`
}
};
Expand Down