Python question

Shane_c82

Gawd
Joined
Mar 26, 2004
Messages
812
New to Python and I can't get this very simple script to run. Any help is appreciated, I'm guessing I don't know how to pass a variable correctly.

record.update(data='127.0.0.1', ttl=600) - works


If I try to use a variable in data= I always get an error.

#uses pycurl to grab IP, assume newip variable is valid IPv4

newip = buf.getvalue()
record.update(data=newip, ttl=600) - does not work
record.update(data='newip', ttl=600) - does not work

Tried many variations of data=new and nothing works.
 
in the future you could do something like
print repr(newip)
to look for unexpected control characters in the data. it will show them escaped, like you would do in a string constant.

also, if you didnt know, .strip() on strings is handy for cleaning up any leading or trailing whitespace.
 
Back
Top