Flask and logging – some questions /u/pachura3 Python Education

Flask and logging – some questions /u/pachura3 Python Education

I. When creating a Flask application, where exactly do I initialize logging?
Right before app = Flask(__name__) ?
Right after it?

II. By default, Flask logs HTTP requests in the common format, i.e.

– 127.0.0.1 – – [05/Oct/2024 20:39:49] “GET / HTTP/1.1” 200 –

How can I change it to the following?

Received POST request “/rest/api/1234/567” from IP 192.168.0.1. Content-Type = “application/json”, Content-Length = 12345, User-Agent = “Mozilla 1.2.3”

III. Last but not least, does the development server included with Flask have some shutdown handler that can be registered to? When user presses Ctrl+C to kill it, I would like to perform some final cleanup operations…

submitted by /u/pachura3
[link] [comments]

​r/learnpython I. When creating a Flask application, where exactly do I initialize logging? Right before app = Flask(__name__) ? Right after it? II. By default, Flask logs HTTP requests in the common format, i.e. – 127.0.0.1 – – [05/Oct/2024 20:39:49] “GET / HTTP/1.1” 200 – How can I change it to the following? Received POST request “/rest/api/1234/567” from IP 192.168.0.1. Content-Type = “application/json”, Content-Length = 12345, User-Agent = “Mozilla 1.2.3” III. Last but not least, does the development server included with Flask have some shutdown handler that can be registered to? When user presses Ctrl+C to kill it, I would like to perform some final cleanup operations… submitted by /u/pachura3 [link] [comments] 

I. When creating a Flask application, where exactly do I initialize logging?
Right before app = Flask(__name__) ?
Right after it?

II. By default, Flask logs HTTP requests in the common format, i.e.

– 127.0.0.1 – – [05/Oct/2024 20:39:49] “GET / HTTP/1.1” 200 –

How can I change it to the following?

Received POST request “/rest/api/1234/567” from IP 192.168.0.1. Content-Type = “application/json”, Content-Length = 12345, User-Agent = “Mozilla 1.2.3”

III. Last but not least, does the development server included with Flask have some shutdown handler that can be registered to? When user presses Ctrl+C to kill it, I would like to perform some final cleanup operations…

submitted by /u/pachura3
[link] [comments]  I. When creating a Flask application, where exactly do I initialize logging? Right before app = Flask(__name__) ? Right after it? II. By default, Flask logs HTTP requests in the common format, i.e. – 127.0.0.1 – – [05/Oct/2024 20:39:49] “GET / HTTP/1.1” 200 – How can I change it to the following? Received POST request “/rest/api/1234/567” from IP 192.168.0.1. Content-Type = “application/json”, Content-Length = 12345, User-Agent = “Mozilla 1.2.3” III. Last but not least, does the development server included with Flask have some shutdown handler that can be registered to? When user presses Ctrl+C to kill it, I would like to perform some final cleanup operations… submitted by /u/pachura3 [link] [comments]

Read more

One UI 7 beta will be available to developers before the end of this year /u/FragmentedChicken Android

One UI 7 beta will be available to developers before the end of this year /u/FragmentedChicken Android

https://news.samsung.com/global/samsung-celebrates-10-years-of-sdc-and-spotlights-ai-based-innovation-at-sdc24

A Sneak Peek at One UI 7

One UI has always been designed to bring users the most personalized, creative and productive experiences possible on mobile devices. Samsung previewed a sneak peek of One UI 7 at SDC24, highlighting its new UX focused on simple, impactful and emotive design alongside more ways to seamlessly integrate Galaxy AI features into daily activities. One UI 7 beta will be available to developers before the end of this year.

submitted by /u/FragmentedChicken
[link] [comments]

​r/Android https://news.samsung.com/global/samsung-celebrates-10-years-of-sdc-and-spotlights-ai-based-innovation-at-sdc24 A Sneak Peek at One UI 7 One UI has always been designed to bring users the most personalized, creative and productive experiences possible on mobile devices. Samsung previewed a sneak peek of One UI 7 at SDC24, highlighting its new UX focused on simple, impactful and emotive design alongside more ways to seamlessly integrate Galaxy AI features into daily activities. One UI 7 beta will be available to developers before the end of this year. submitted by /u/FragmentedChicken [link] [comments] 

https://news.samsung.com/global/samsung-celebrates-10-years-of-sdc-and-spotlights-ai-based-innovation-at-sdc24

A Sneak Peek at One UI 7

One UI has always been designed to bring users the most personalized, creative and productive experiences possible on mobile devices. Samsung previewed a sneak peek of One UI 7 at SDC24, highlighting its new UX focused on simple, impactful and emotive design alongside more ways to seamlessly integrate Galaxy AI features into daily activities. One UI 7 beta will be available to developers before the end of this year.

submitted by /u/FragmentedChicken
[link] [comments]  https://news.samsung.com/global/samsung-celebrates-10-years-of-sdc-and-spotlights-ai-based-innovation-at-sdc24 A Sneak Peek at One UI 7 One UI has always been designed to bring users the most personalized, creative and productive experiences possible on mobile devices. Samsung previewed a sneak peek of One UI 7 at SDC24, highlighting its new UX focused on simple, impactful and emotive design alongside more ways to seamlessly integrate Galaxy AI features into daily activities. One UI 7 beta will be available to developers before the end of this year. submitted by /u/FragmentedChicken [link] [comments]

Read more

Library suggestion for advanced image integrity check beyond basic file opening? /u/AstonM77 Python Education

Library suggestion for advanced image integrity check beyond basic file opening? /u/AstonM77 Python Education

I have been using ffmpeg-probe for initial video file corruption testing and a relatively simple test to determine if image files open. But in the process of running these same files through object detection analysis I am finding a number of them that are legitimately corrupted upon closer inspection (often times look like they stopped progressively loading or some other issue).

I have tried to find an existing library or tool that was made for this type of test, but as of yet I haven’t been able to locate anything that wasn’t some form of the basic functionality I already have.

Can anyone suggest a library that might be a good option.

submitted by /u/AstonM77
[link] [comments]

​r/learnpython I have been using ffmpeg-probe for initial video file corruption testing and a relatively simple test to determine if image files open. But in the process of running these same files through object detection analysis I am finding a number of them that are legitimately corrupted upon closer inspection (often times look like they stopped progressively loading or some other issue). I have tried to find an existing library or tool that was made for this type of test, but as of yet I haven’t been able to locate anything that wasn’t some form of the basic functionality I already have. Can anyone suggest a library that might be a good option. submitted by /u/AstonM77 [link] [comments] 

I have been using ffmpeg-probe for initial video file corruption testing and a relatively simple test to determine if image files open. But in the process of running these same files through object detection analysis I am finding a number of them that are legitimately corrupted upon closer inspection (often times look like they stopped progressively loading or some other issue).

I have tried to find an existing library or tool that was made for this type of test, but as of yet I haven’t been able to locate anything that wasn’t some form of the basic functionality I already have.

Can anyone suggest a library that might be a good option.

submitted by /u/AstonM77
[link] [comments]  I have been using ffmpeg-probe for initial video file corruption testing and a relatively simple test to determine if image files open. But in the process of running these same files through object detection analysis I am finding a number of them that are legitimately corrupted upon closer inspection (often times look like they stopped progressively loading or some other issue). I have tried to find an existing library or tool that was made for this type of test, but as of yet I haven’t been able to locate anything that wasn’t some form of the basic functionality I already have. Can anyone suggest a library that might be a good option. submitted by /u/AstonM77 [link] [comments]

Read more

Mastering advanced python concepts /u/anirudhkarumuri Python Education

Mastering advanced python concepts /u/anirudhkarumuri Python Education

What are some advanced python topics one should master to be an efficient programmer in python? #python

Some of which I consider:

1) multithreading 2) design patterns 3) concurrency 4) Pybindings 5) generation of python executables 6) decorators and encapsulation 7) metaclasses 8) Inheritance 9) Generators and Dunder methods 10) context managers 11) itertools

What are some great books to learn apart from fluent python from O’Reilly publication?

submitted by /u/anirudhkarumuri
[link] [comments]

​r/learnpython What are some advanced python topics one should master to be an efficient programmer in python? #python Some of which I consider: 1) multithreading 2) design patterns 3) concurrency 4) Pybindings 5) generation of python executables 6) decorators and encapsulation 7) metaclasses 8) Inheritance 9) Generators and Dunder methods 10) context managers 11) itertools What are some great books to learn apart from fluent python from O’Reilly publication? submitted by /u/anirudhkarumuri [link] [comments] 

What are some advanced python topics one should master to be an efficient programmer in python? #python

Some of which I consider:

1) multithreading 2) design patterns 3) concurrency 4) Pybindings 5) generation of python executables 6) decorators and encapsulation 7) metaclasses 8) Inheritance 9) Generators and Dunder methods 10) context managers 11) itertools

What are some great books to learn apart from fluent python from O’Reilly publication?

submitted by /u/anirudhkarumuri
[link] [comments]  What are some advanced python topics one should master to be an efficient programmer in python? #python Some of which I consider: 1) multithreading 2) design patterns 3) concurrency 4) Pybindings 5) generation of python executables 6) decorators and encapsulation 7) metaclasses 8) Inheritance 9) Generators and Dunder methods 10) context managers 11) itertools What are some great books to learn apart from fluent python from O’Reilly publication? submitted by /u/anirudhkarumuri [link] [comments]

Read more

importing modules just to get types for hinting /u/heyzooschristos Python Education

importing modules just to get types for hinting /u/heyzooschristos Python Education

I have e.g. a utils.py file containing helper functions that I want to type hint. utils.py doesnt need any non standard lib imports but receives and returns non-standard types, so I have to import the modules into utils.py just to be able to add the type hints – is that right / normal practise? I know in Python I can import the same lib from multiple files in the same project and it only actually imports each once, so its not a real problem, just seems like a lot of “unecessary” imports and wondering if there is a different or more preferred way to get types?

submitted by /u/heyzooschristos
[link] [comments]

​r/learnpython I have e.g. a utils.py file containing helper functions that I want to type hint. utils.py doesnt need any non standard lib imports but receives and returns non-standard types, so I have to import the modules into utils.py just to be able to add the type hints – is that right / normal practise? I know in Python I can import the same lib from multiple files in the same project and it only actually imports each once, so its not a real problem, just seems like a lot of “unecessary” imports and wondering if there is a different or more preferred way to get types? submitted by /u/heyzooschristos [link] [comments] 

I have e.g. a utils.py file containing helper functions that I want to type hint. utils.py doesnt need any non standard lib imports but receives and returns non-standard types, so I have to import the modules into utils.py just to be able to add the type hints – is that right / normal practise? I know in Python I can import the same lib from multiple files in the same project and it only actually imports each once, so its not a real problem, just seems like a lot of “unecessary” imports and wondering if there is a different or more preferred way to get types?

submitted by /u/heyzooschristos
[link] [comments]  I have e.g. a utils.py file containing helper functions that I want to type hint. utils.py doesnt need any non standard lib imports but receives and returns non-standard types, so I have to import the modules into utils.py just to be able to add the type hints – is that right / normal practise? I know in Python I can import the same lib from multiple files in the same project and it only actually imports each once, so its not a real problem, just seems like a lot of “unecessary” imports and wondering if there is a different or more preferred way to get types? submitted by /u/heyzooschristos [link] [comments]

Read more