Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
arbs09 committed Mar 17, 2024
1 parent fc32d1a commit 3567659
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ def report_ip(ip, categories, comment):
return response.json()

def save_to_file(ip):
timestamp = datetime.now().strftime('%Y.%m.%d %H:%M')
with open('report.txt', 'a') as file:
file.write(f'{timestamp} ; {ip}\n')
timestamp = datetime.now().strftime('%Y.%m.%d %H:%M')
if not os.path.exists('data'):
os.makedirs('data')
with open(os.path.join('data', 'report.txt'), 'a') as file:
file.write(f'{timestamp} ; {ip}\n')

@app.before_request
def get_client_ip():
Expand Down

0 comments on commit 3567659

Please sign in to comment.