DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Python - Change User-agent
// Cambiare user-agent con urllib
import urllib class AppURLopener(urllib.FancyURLopener): version = 'Nokia6630/1.0 (2.3.129) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1' urllib._urlopener = AppURLopener()
// Cambiare user-agent con urllib2
import urllib2
headers = { 'user-agent':'Nokia6630/1.0 (2.3.129) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1',
'keep-alive':'300',
'content-type':'application/x-www-form-urlencoded'
}





