diff --git a/README.md b/README.md index 1bbc7e0..1b3b164 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ ![downloads](https://img.shields.io/github/downloads/axiaoxin/flask-skeleton/total.svg) ![license](https://img.shields.io/github/license/axiaoxin/flask-skeleton.svg) ![issues](https://img.shields.io/github/issues/axiaoxin/flask-skeleton.svg) +[![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/axiaoxin) flask-skeleton -------------- diff --git a/app/utils/__init__.py b/app/utils/__init__.py index ad15d2d..9e12af5 100644 --- a/app/utils/__init__.py +++ b/app/utils/__init__.py @@ -6,6 +6,7 @@ import types import inspect import re +import socket from flask import abort from cerberus import Validator @@ -15,6 +16,13 @@ import settings +def hostname(): + try: + return socket.gethostname() + except Exception as e: + app_logger.exception(e) + + def is_ipv4(ip): if re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", ip): return True