Sorry Victor, Ralph, about the name problems; irrespective of the
identifier, I was actually using the correct page access token, the same
one as for creating the posts.
So: following your suggestion to hard-code as much as possible, I
created a fresh set of 3 posts then ran the shortened delete routine -
three times return code 200, and checked the Facebook page - three posts
well and truly deleted.
Now I have to work out why the parameterised version doesn't work:
I've taken the post_id into the url and kept the access hard-coded:
url = 'https://graph.facebook.com/'+ x[1]
print(url)
# Setting up parameters
response = requests.delete(url,
params={'access_token':'EAAlFB9sQx7wBQKl........
However, when I print the url that goes to the request, I get this:
https://graph.facebook.com/742194719255364_1531586289001525
https://graph.facebook.com/742194719255364_1531586289001525%0A?access_token=EAAlFB9sQx7wBQKl.....
the characters %0A? separate the params bit, and the call fails:
<Response [400]>
BUT
response = requests.delete(
'https://graph.facebook.com/742194719255364_1531586289001525',
params={'access_token': 'EAAlFB9sQx7wBQKl.........
results in a call:
https://graph.facebook.com/742194719255364_1531586289001525?access_token=EAAlFB9sQx7wBQKlZB
which works.
Where did the %0A come from?
(gone to have a think)
Graeme
--
Next meeting: Online, Jitsi, Tuesday, 2026-09-01 20:00
Check to whom you are replying
Meetings, mailing list, IRC, ... https://dorset.lug.org.uk
New thread, don't hijack: mailto:[email protected]