+15
-4
x.py
+15
-4
x.py
···
124
124
125
125
except requests.exceptions.HTTPError as e:
126
126
if response.status_code == 401:
127
-
logger.error("X API authentication failed for posting - check your bearer token permissions")
127
+
logger.error("X API authentication failed for posting - check your bearer token")
128
+
logger.error(f"Response: {response.text}")
128
129
elif response.status_code == 403:
129
-
logger.error("X API posting forbidden - may need elevated access or different permissions")
130
+
logger.error("X API posting forbidden - likely app permissions issue")
131
+
logger.error("Check that your X app has 'Read and Write' permissions enabled")
132
+
logger.error(f"Response: {response.text}")
130
133
elif response.status_code == 429:
131
134
logger.error("X API rate limit exceeded for posting")
135
+
logger.error(f"Response: {response.text}")
132
136
else:
133
137
logger.error(f"X API post request failed: {e}")
134
138
logger.error(f"Response content: {response.text}")
···
199
203
print(f"Test failed: {e}")
200
204
201
205
def reply_to_cameron_post():
202
-
"""Reply to Cameron's specific X post."""
206
+
"""
207
+
Reply to Cameron's specific X post.
208
+
209
+
NOTE: This requires OAuth User Context authentication, not Bearer token.
210
+
Current Bearer token is Application-Only which can't post.
211
+
"""
203
212
try:
204
213
client = create_x_client()
205
214
···
211
220
212
221
print(f"Attempting to reply to post {cameron_post_id}")
213
222
print(f"Reply text: {reply_text}")
223
+
print("\nNOTE: This will fail with current Bearer token (Application-Only)")
224
+
print("Posting requires OAuth User Context authentication")
214
225
215
226
result = client.post_reply(reply_text, cameron_post_id)
216
227
···
218
229
print(f"✅ Successfully posted reply!")
219
230
print(f"Reply ID: {result.get('data', {}).get('id', 'Unknown')}")
220
231
else:
221
-
print("❌ Failed to post reply")
232
+
print("❌ Failed to post reply (expected with current auth)")
222
233
223
234
except Exception as e:
224
235
print(f"Reply failed: {e}")