Ralph, thanks for that. I'm well aware of /n when writing lines, it's easy to forget them when reading.

Graeme

On 01/09/2026 16:25, Ralph Corderoy wrote:
Hi Graeme,

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)
          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%0A?access_token=EAAlFB9sQx7wBQKl.....

the characters %0A? separate the params bit, and the call fails:
<Response [400]>
...
Where did the %0A come from?
It's at the end of x[1].  It's a hex encoding of ASCII LF, a line feed.
You're probably reading in a line from a text file, but not stripping
off the line feed.

     >>> f = open('/etc/passwd')
     >>> l = f.readline()
     >>> l
     'root:x:0:0:root:/root:/bin/bash\n'
     >>> assert l[-1] == '\n'
     >>> l = l[:-1]
     >>> l
     'root:x:0:0:root:/root:/bin/bash'
     >>>


--
 Next meeting: Online, Jitsi, Tuesday, 2026-10-06 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]

Reply via email to