There isn't currently a way to query bonds from within the PyMOL API.  However, you can travel a Pythonic data structure derived from PyMOL's internal state:
for bond in cmd.get_model().bond: print bond.index
...where the index displayed corresponds to PyMOL's internal atom index...
iterate all, print (resn, resi, name, index)
DeLano Scientific LLC
Subscriber Support Services
"Not yet a PyMOL Subscriber, but want to support the project?  Email to quote your lab, school, or employer.  Thank you for sponsoring this open-source endeavor!" -WLD

From: [] On Behalf Of Piter_
Sent: Wednesday, October 17, 2007 3:52 AM
Subject: [PyMOL] is there bond ? How to check?

Hi all
I want to write a script like this:

if there is bond between atom1 and atom2
      do something
elif there is no bond between atom1 and atom2
      do something else.

But I don't know how to check the bond existence between atoms in Pymol.

Thanks in advance for any idea how to do it.