webmazta commited on
Commit
f7adcbf
·
1 Parent(s): 565ce60

fix(main): add Origin/Referer headers to WP media uploads

Browse files
Files changed (1) hide show
  1. main.py +6 -1
main.py CHANGED
@@ -1344,7 +1344,12 @@ def upload_media_to_wp(file_path: Path, filename: str = None) -> dict:
1344
  headers = {
1345
  "Content-Disposition": f'attachment; filename="{filename}"',
1346
  "Content-Type": mime_type,
1347
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
 
 
 
 
 
1348
  }
1349
 
1350
  with open(file_path, "rb") as f:
 
1344
  headers = {
1345
  "Content-Disposition": f'attachment; filename="{filename}"',
1346
  "Content-Type": mime_type,
1347
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
1348
+ "Accept": "application/json, */*",
1349
+ "Accept-Encoding": "identity",
1350
+ "Origin": wp_url,
1351
+ "Referer": f"{wp_url}/wp-admin/upload.php",
1352
+ "Connection": "keep-alive",
1353
  }
1354
 
1355
  with open(file_path, "rb") as f: