Created
June 19, 2016 07:05
-
-
Save toughrogrammer/e4403221ca23d69037fd009e26da1dbb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from app import api_root | |
from flask_restful import Resource | |
@api_root.resource('/documents') | |
class DocumentListAPI(Resource): | |
def get(self): | |
items = [ | |
{'id': 1, 'title': 'title1', 'content': 'content1', 'ip': '1.2.3.4'}, | |
{'id': 2, 'title': 'title2', 'content': 'content2', 'ip': '5.6.7.8'}, | |
{'id': 3, 'title': 'title3', 'content': 'content3', 'ip': '9.10.11.12'} | |
] | |
for item in items: | |
parts = item['ip'].split('.') | |
parts[1] = '***' | |
item['ip'] = '.'.join(parts) | |
return { | |
'items': items | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment