I have a list of IPs in MAXCDN_ARRAY to be used as whitelist. I want to check if a specific IP address is in range in this array. How can I structure the code so that it can compare all IPs in the array and say the specific IP in in range of this list or not?
GrepCIDR
You can use grepcidr to check if an IP address is in a list of CIDR networks.
Asynchronous code has increasingly become a mainstay of Python development. With asyncio becoming part of the standard library and many third party packages providing features compatible with it, this paradigm is not going away anytime soon.
Let's walk through how to use the aiohttp library to take advantage of this for making asynchronous HTTP requests, which is one of the most common use cases for non-blocking code.
What is non-blocking code?
You may hear terms like "asynchronous", "non-blocking" or "concurrent" and be a little confused as to what they all mean. According to this much more detailed tutorial , two of the primary properties are:
Logging is one of the most important aspects of software development. The developers log events like successful completion, warnings, errors, fatal errors, etc. These logs can help developers in various ways like find out the root cause in case of when some failure happens in the future, look for slow parts of the code for optimization, etc. Python provides a module named logging which has a vast API that can be used to log events in Python. We have already covered a very detailed tutorial covering the majority of the API of python logging module . Please feel free to check it if you are interested in learning about it (link below). This tutorial will build on that tutorial and explain how we can configure logging module based on the configuration from dictionary and configuration files. It's recommended to have knowledge of the logging module explained in that tutorial to continue with this tutorial.