sojorn/import requests.py
Patrick Britton 3c4680bdd7 Initial commit: Complete threaded conversation system with inline replies
**Major Features Added:**
- **Inline Reply System**: Replace compose screen with inline reply boxes
- **Thread Navigation**: Parent/child navigation with jump functionality
- **Chain Flow UI**: Reply counts, expand/collapse animations, visual hierarchy
- **Enhanced Animations**: Smooth transitions, hover effects, micro-interactions

 **Frontend Changes:**
- **ThreadedCommentWidget**: Complete rewrite with animations and navigation
- **ThreadNode Model**: Added parent references and descendant counting
- **ThreadedConversationScreen**: Integrated navigation handlers
- **PostDetailScreen**: Replaced with threaded conversation view
- **ComposeScreen**: Added reply indicators and context
- **PostActions**: Fixed visibility checks for chain buttons

 **Backend Changes:**
- **API Route**: Added /posts/:id/thread endpoint
- **Post Repository**: Include allow_chain and visibility fields in feed
- **Thread Handler**: Support for fetching post chains

 **UI/UX Improvements:**
- **Reply Context**: Clear indication when replying to specific posts
- **Character Counting**: 500 character limit with live counter
- **Visual Hierarchy**: Depth-based indentation and styling
- **Smooth Animations**: SizeTransition, FadeTransition, hover states
- **Chain Navigation**: Parent/child buttons with visual feedback

 **Technical Enhancements:**
- **Animation Controllers**: Proper lifecycle management
- **State Management**: Clean separation of concerns
- **Navigation Callbacks**: Reusable navigation system
- **Error Handling**: Graceful fallbacks and user feedback

This creates a Reddit-style threaded conversation experience with smooth
animations, inline replies, and intuitive navigation between posts in a chain.
2026-01-30 07:40:19 -06:00

54 lines
1.9 KiB
Python

import requests
import json
from datetime import datetime, timedelta
def get_iceout_data():
# 1. Define the endpoint
url = "https://iceout.org/api/reports/"
# 2. Set the time range (e.g., last 24 hours)
now = datetime.utcnow()
yesterday = now - timedelta(days=1)
# Format dates as ISO 8601 strings
params = {
"archived": "False",
"incident_time__gte": yesterday.strftime("%Y-%m-%dT%H:%M:%S.000Z"),
"incident_time__lte": now.strftime("%Y-%m-%dT%H:%M:%S.000Z")
}
# 3. Mimic the Headers from the HAR file
# The 'X-API-Version' and 'User-Agent' are critical.
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36",
"X-API-Version": "1.4",
"Accept": "application/json", # Force server to return JSON, not MsgPack
"Referer": "https://iceout.org/en/"
}
try:
# 4. Make the Request
response = requests.get(url, headers=headers, params=params)
response.raise_for_status()
# 5. Parse and Print Data
data = response.json()
# Depending on the response structure (list or object), print the results
if isinstance(data, list):
print(f"Found {len(data)} reports.")
for report in data[:3]: # Print first 3 as a sample
print(f"ID: {report.get('id')}")
print(f"Location: {report.get('location_description')}")
print(f"Description: {report.get('activity_description')}")
print("-" * 30)
else:
# Sometimes APIs return a wrapper object
print("Response received:")
print(json.dumps(data, indent=2))
except requests.exceptions.RequestException as e:
print(f"Error fetching data: {e}")
if __name__ == "__main__":
get_iceout_data()