TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #303 · 27 дек.

Наверняка вы замечали, что в Python есть удобная функция для получения переменной окружения os.getenv(NAME) И её "сестра" для создания или изменения переменных окружения os.putenv(NAME, VALUE) Но почему-то putenv() не работает как должно. Энвайромент не обновляется! os.putenv('MYVAR', '1') print(os.getenv('MYVAR')) ... и ничего 😴 Почему так? На самом деле энвайромент обновляется, но это значение не добавляется в словарь os.environ. Откройте исходник функции os.getenv(). Это просто шорткат для os.environ.get() В то время как putenv() это built-in С-функция. Словарь os.environ (или точней класс из MutableMapping) создаётся из энвайромента в момент инициализации. Функция putenv() самостоятельно его не изменяет. В тоже время, когда вы создаёте или изменяете ключ в os.environ, автоматически вызывается putenv() в методе __setitem__(). То есть, технически putenv() всё делает верно, но в os.environ это не отражается. Можно проверить так: >>> os.putenv('MYVAR', '123') >>> os.system('python -c "import os;print(os.getenv(\'MYVAR\'))"') 123 Я объявил переменную в текущем процессе и вызвал дочерний процесс, который её унаследовал и получил в составе os.environ. Аналогично при удалении переменной вызывается еще одна built-in функция unsetenv(), удаляющая переменную из системы. Итого ▫️ Удобней всего явно обновлять переменные через os.environ ▫️ Есть способ неявно создать/удалить переменную через putenv/unsetenv, что не повлияет на os.environ но изменит энвайромент и передаст изменения сабпроцессам. Но так лучше не делать! ▫️os.environ это просто обертка для built-in функций putenv() и unsetenv(). #basic

Hashtags

Резултати

Пронајдени 6 слични објави

Пребарај: #websockets

当前筛选 #websockets清除筛选
djangoproject

@djangoproject · Post #279 · 20.03.2017 г., 07:42

https://realpython.com/blog/python/getting-started-with-django-channels/#.WLWLY9_IJ0s.linkedin In this tutorial, we will use #Django_Channels to create a real-time application that updates a list of users as they log in and out. Django Channels Logo With #WebSockets (via Django Channels) managing the communication between the client and the server, whenever a user is authenticated, an event will be broadcasted to every other connected user. Each user’s screen will change automatically, without them having to reload their browsers.

djangoproject

@djangoproject · Post #576 · 02.03.2018 г., 12:52

https://www.obeythetestinggoat.com/pages/book.html#toc "Test-Driven Web Development with Python" aims to teach #TDD for web programming. It uses a concrete example — the development of a website, from scratch — to explain the TDD metholology and how it applies to building web applications. It covers the #Selenium browser-automation tool, #unit_testing, mocking, and interacting with Web technologies from the basics of static content, database integration, throught the inescapable JavaScript, and onto more advanced (and trendy) topics like #NoSQL, #websockets and Async programming.

djangoproject

@djangoproject · Post #517 · 08.12.2017 г., 05:27

https://vorpus.org/blog/some-thoughts-on-asynchronous-api-design-in-a-post-asyncawait-world/#websocket-servers I've recently been exploring the exciting new world of #asynchronous I/O libraries in Python 3 – specifically asyncio and curio. These two libraries make some different design choices. Example 1: #asyncio, with callbacks Example 2: #curio, with #async/#await Example 3: asyncio, with async/await #websockets

djangoproject

@djangoproject · Post #228 · 16.01.2017 г., 13:11

http://www.aparat.com/v/miNUS pycon 2016- Andrew Godwin - Reinventing Django for the #Real_Time Web Django has long been tied to the #request_response pattern, but the upcoming "#channels" project changes this and allows #Django to natively support #WebSockets, running tasks after responses, easily handle #long_polling and more. Come and learn about the design, how we're trying to keep things as Django-like as possible, and how you can use it in your projects.

GitHub Trends

@githubtrending · Post #15556 · 12.03.2026 г., 12:30

#typescript#ai#ai_agents#coding#deno#embeddings#insforge#nextjs#oauth2#pgvector#postgresql#realtime#vectors#websockets InsForge is an open-source backend platform for AI coding agents, offering easy auth, Postgres database, S3 storage, edge functions, and model gateway via a simple semantic layer. Agents fetch context, configure services, and inspect state to build full-stack apps quickly. Set up locally with Docker or use cloud deploys. It boosts agent accuracy 1.7x, speed 1.6x, and cuts tokens 30% vs. rivals, letting you prototype and ship AI-driven apps faster with less hassle and cost. https://github.com/InsForge/InsForge

GitHub Trends

@githubtrending · Post #15204 · 08.10.2025 г., 11:30

#java#cloud#coap#dashboard#iot#iot_analytics#iot_platform#iot_solutions#java#kafka#lwm2m#microservices#middleware#mqtt#netty#platform#snmp#thingsboard#visualization#websockets#widgets ThingsBoard is an open-source IoT platform that helps manage and analyze data from connected devices. It allows users to collect data, create real-time dashboards, and automate tasks using a powerful rule engine. This platform supports various protocols like MQTT and HTTP, making it easy to connect devices. Users can also define relationships between devices and assets, and trigger alarms based on specific conditions. The benefit is that it simplifies IoT project development, making it scalable and efficient for applications like smart farming, smart offices, and more. https://github.com/thingsboard/thingsboard