commit bc55b7a7885681b7176c194c5974a3fed4a09aa6
parent 08f64abc5602440959120bf1d58f91224e1d3bc7
Author: rbckman <rob@tarina.org>
Date: Sat, 22 Aug 2026 12:56:55 +0300
json
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/server.py b/server.py
@@ -1904,6 +1904,14 @@ class pull:
pullposts = requests.get('https://'+t['servername']+'/pull?name='+t['user']+'&postid='+postid)
print(pullposts)
print('sdasddffffffffffffff')
+ pullposts.raise_for_status() # raises an error for bad status codes
+ # Try to parse as JSON
+ try:
+ posts = pullposts.json()
+ print(json.dumps(posts))
+ except requests.exceptions.JSONDecodeError:
+ print("Response is not valid JSON.")
+ print("Raw content:", pullposts.text)
#zippandshipp=[]
#if t['user']!=None:
# users = os.listdir(basedir+'r/users/')
@@ -1912,7 +1920,7 @@ class pull:
# for p in posts:
# if p['creator']==r['name']:
# pullnunzip.append(p)
- for p in pullposts:
+ for p in posts:
print('hold on pulling new posts')
os.system('wget -o '+basedir+'p/zipped/ https://'+t['servername']+'/static/users/'+p['name']+'/zipped/'+p['postid']+'.zip')
os.system('cd '+basedir+'p/zipped/ && unzip -o '+p['postid']+'.zip -d '+basedir+'u/'+session.user+'/posts/')