Working On Some Things...
Trying to create a traffic mapping API kinda thing to give to the local government...wish me luck
app.py
import os
import json
from flask import Flask, request, jsonify, render_template
import boto3
from datetime import datetime
from flask_cors import CORS
app = Flask(__name__)
CORS(app) # Enable CORS for all routes
# Health check endpoint
@app.route('/health')
def health():
return 'OK', 200
# Load S3 credentials from environment variables
S3_KEY = os.environ.get('FILEBASE_KEY')
S3_SECRET = os.environ.get('FILEBASE_SECRET')
S3_BUCKET = os.environ.get('FILEBASE_BUCKET', 'harford-accidents')
S3_ENDPOINT = 'https://s3.filebase.com'
LOG_FILE = 'accident_log.json'
# Helper: upload file to Filebase and return IPFS CID
def upload_to_filebase(filename):
s3 = boto3.client('s3',
endpoint_url=S3_ENDPOINT,
aws_access_key_id=S3_KEY,
aws_secret_access_key=S3_SECRET
)
s3.upload_file(filename, S3_BUCKET, filename)
# Get the CID from the file's metadata
obj = s3.head_object(Bucket=S3_BUCKET, Key=filename)
return obj['Metadata'].get('ipfs-hash', 'Unknown')
@app.route('/')
def index():
return render_template('index.html')
@app.route('/report', methods=['POST'])
def report():
data = request.json
# Add timestamp
data['timestamp'] = datetime.utcnow().isoformat()
# Load or create log
if os.path.exists(LOG_FILE):
with open(LOG_FILE, 'r') as f:
log = json.load(f)
else:
log = []
log.append(data)
with open(LOG_FILE, 'w') as f:
json.dump(log, f, indent=2)
# Upload to Filebase
cid = upload_to_filebase(LOG_FILE)
return jsonify({'status': 'ok', 'cid': cid, 'log_length': len(log)})
@app.route('/log')
def get_log():
if os.path.exists(LOG_FILE):
with open(LOG_FILE) as f:
return jsonify(json.load(f))
return jsonify([])
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
``` <br/> _This report was published via Actifit app ([Android](https://bit.ly/actifit-app) | [iOS](https://bit.ly/actifit-ios)). Check out the original version [here on actifit.io](https://actifit.io/@strangedad/actifit-strangedad-20250801t023538212z)_ <br/> <br><img src="https://cdn.steemitimages.com/DQmXv9QWiAYiLCSr3sKxVzUJVrgin3ZZWM2CExEo3fd5GUS/sep3.png"><br><table> <tr> <img src="https://actifit.s3.us-east-1.amazonaws.com/ACTIVITYDATE.png"> </tr> <tr> <div class="text-center"><b>30/07/2025</b></div> </tr></table><table> <tr> <img src="https://cdn.steemitimages.com/DQmRgAoqi4vUVymaro8hXdRraNX6LHkXhMRBZxEo5vVWXDN/ACTIVITYCOUNT.png"> </tr> <tr> <div class="text-center"><b>6112</b></div> </tr></table><table> <tr> <img src="https://cdn.steemitimages.com/DQmZ6ZT8VaEpaDzB16qZzK8omffbWUpEpe4BkJkMXmN3xrF/ACTIVITYTYPE.png"> </tr> <tr> <div class="text-center"><pre><b>Daily Activity</b></div></pre></div> </tr></table><div class="text-center"><img src="https://cdn.steemitimages.com/DQmW1VsUNbEjTUKawau4KJQ6agf41p69teEvdGAj1TMXmuc/A-5.png"><a href="https://bit.ly/actifit-app"><img src="https://cdn.steemitimages.com/DQmQqfpSmcQtfrHAtzfBtVccXwUL9vKNgZJ2j93m8WNjizw/l5.png"></a><a href="https://bit.ly/actifit-ios"><img src="https://cdn.steemitimages.com/DQmbWy8KzKT1UvCvznUTaFPw6wBUcyLtBT5XL9wdbB7Hfmn/l6.png"></a></div>
hive-193552
actifit
pimp
neoxian
palnet
waivio
utopis
archon
proofofbrain
lassecash
bilpcoin
leo
list
peakecoin
bee
lern
ctp
hivehustlers
stem
byte
sportstalk
movetoearn
move2earn
0
0
0.000
Good luck to you! Good job with your 6112 @actifit steps for the day. Take care!
Congrats on providing Proof of Activity via your Actifit report!
You have been rewarded 46.6375 AFIT tokens for your effort in reaching 6112 activity, as well as your user rank and report quality!
You also received a 0.91% upvote via @actifit account.
Rewards Details
AFIT rewards and upvotes are based on your:
To improve your user rank, delegate more, pile up more AFIT and AFITX tokens, and post more.
To improve your post score, get to the max activity count, work on improving your post content, improve your user rank, engage with the community to get more upvotes and quality comments.
Chat with us on discord | Visit our website
Follow us on Twitter | Join us on Telegram
Download on playstore | Download on app store
Knowledge base:

FAQs | Whitepaper
How to signup | Maximize your rewards
Complete Actifit Tutorial
Support our efforts below by voting for: