A Counter is a container that tracks how many times equivalent values are added.
Python Mechanize: web browsing
Stateful programmatic web browsing in Python, after Andy Lester’s Perl module
WWW::Mechanize
.
mechanize.Browser
andmechanize.UserAgentBase
implement the interface ofurllib2.OpenerDirector
, so:
- any URL can be opened, not just
http:
mechanize.UserAgentBase
offers easy dynamic configuration of user-agent features like protocol, cookie, redirection androbots.txt
handling, without having to make a newOpenerDirector
each time, e.g. by callingbuild_opener()
.- Easy HTML form filling.
- Convenient link parsing and following.
- Browser history (
.back()
and.reload()
methods).- The
Referer
HTTP header is added properly (optional).- Automatic observance of
robots.txt
.
PyCURL
Introduction to Python async/await
Python 3.5 is coming up soon with async and await built-in keywords. Let’s get excited with a couple of simple examples showing off how to use this new syntax.