Skip to content

Instantly share code, notes, and snippets.

@fmasanori
Last active December 11, 2015 21:59
Show Gist options
  • Save fmasanori/4666602 to your computer and use it in GitHub Desktop.
Save fmasanori/4666602 to your computer and use it in GitHub Desktop.
Python 3.x Twitter Profile Photo
#
# API DEPRECATED AT JUNE 2013
# https://dev.twitter.com/docs/faq#17750
#
import urllib.request
import json
url = 'https://api.twitter.com/1/users/profile_image?screen_name='
user = 'fmasanori'
size = '&size=bigger'
resp = urllib.request.urlopen(url+user+size).read()
arquivo = 'Foto perfil '+user+'.jpg'
f = open(arquivo, 'wb')
f.write(resp)
f.close()
print (arquivo, 'gravado no diretório atual...')
@jtomaszon
Copy link

Python rulz! #cpbr6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment