diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2014-06-04 01:27:51 -0400 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2014-06-24 21:56:46 -0400 |
commit | c0b0f2eecc78a862fa85d77102f2a650c1936592 (patch) | |
tree | 49a8d9a5c500e397fbd00a903bb35d2449d097fd /examples | |
parent | 80205d1f4385802d6ebcbaf47d25c6bb46b097b6 (diff) | |
download | pycurl-c0b0f2eecc78a862fa85d77102f2a650c1936592.tar.gz |
Quickstart - following redirects and setting options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quickstart/follow_redirect.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/quickstart/follow_redirect.py b/examples/quickstart/follow_redirect.py new file mode 100644 index 0000000..9e3e3e4 --- /dev/null +++ b/examples/quickstart/follow_redirect.py @@ -0,0 +1,13 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# vi:ts=4:et + +import pycurl + +c = pycurl.Curl() +# Redirects to https://www.python.org/. +c.setopt(c.URL, 'http://www.python.org/') +# Follow redirect. +c.setopt(c.FOLLOWLOCATION, True) +c.perform() +c.close() |