Skip to content

Commit

Permalink
add say thanks and add hostname for utils
Browse files Browse the repository at this point in the history
  • Loading branch information
axiaoxin committed Sep 10, 2018
1 parent c2ef550 commit a3bb00f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------
Expand Down
8 changes: 8 additions & 0 deletions app/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import types
import inspect
import re
import socket

from flask import abort
from cerberus import Validator
Expand All @@ -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
Expand Down

0 comments on commit a3bb00f

Please sign in to comment.