Clone wiki

Pynav / Pynav-0.6

Pynav 0.6

Pynav 0.6 is no longer maintained, you should use the new version: Pynav-0.7 branch


Pynav is a Python programmatic web browser to fetch data and test web sites.
Bug reporting and features asking are welcome.
Pynav on pypi :


  • Post authentication
  • User agent support
  • Automatic cookie handling
  • HTTP Basic Authentication support
  • HTTPS support
  • Proxy support
  • Timeout support
  • Reg exp searching
  • Links fetching with reg exp filter
  • History (pages, posts and responses)
  • Save and load history from a file and replay navigation
  • Random sleep time beetween pages
  • Errors handling
  • Document type and server headers information, real url (in case of redirection)


  • Best files handle : Read header of the http server response to get the file type and the real file name.
  • File upload support in post values.


GNU General Public License (GPL)



Minimum Python version: 2.5

Works on Python 2.6

Works on Android with ASE

Latest stable version with pip

    $ pip install pynav

Latest stable version with easy_install

    $ easy_install pynav

or a specific version:

    $ easy_install

Latest stable version from tar.gz archive

Download pynav-0.6.5.tar.gz and extract it:

    $ wget
    $ tar xzf pynav-0.6.5.tar.gz

Go into the extracted directory and run

    $ cd pynav-0.6.5/
    $ python install

Dev version from hg source

$ hg clone


Post authentication, images and files downloading with simple filter or regular expression

from pynav import Pynav

def test1():
    p = Pynav()
    p.go('', {'login' : 'toto', 'pass' : 'toto'})
    if p.find('My profile'):
        print 'connected into profile area'


    for image in p.get_all_images('.png'):, '/tmp/images/')

    for link in n.get_all_links('download_part.*?\.zip'):


Using HTTP Basic authentication, post authentication and cookie check

def test2():
    p = Pynav(timeout=5)
    p.set_http_auth('', 'login', 'pass')

    p.go('', {'login' : 'toto', 'pass' : 'toto'})
    if p.cookie_exists('id'):
        print 'Connected

    p.set_page_delay(2, 4)

    for link in p.get_all_links('news'):
        print link

    for page in p.history:
        print page['url'], ':', page['post']


Using proxy

def test3():
    p = Pynav(timeout=6, proxy='')
    p.referer = ''
    page = p.go('')
    print p.strip_tags(page)