Can someone please let me know how I can connect to an external PG database through Python? (using pygresql or any other library -please specify which lib you use). I am at total loss; there's no useful tutorial on how to do this! There's only one example on the whole 'net (the bike rider club) which is not helpful.

I just need that small piece of code that would let me connect to, say, with username 'bob' and password '123' and dbname='mydb'.

I already have installed the client version of PG 8.2. Haven't made any changes to the .conf files.

I really appreciate any help.

P.S> I have already tried something like:
import pg
con1=pg.connect(dbname='mydb', host='', user='bob', passwd='123')
which gives me
InternalError: FATAL: no pg_hba.conf entry for host "", ...