It is specified in an http header content-disposition. So to extract the name you would do:
import re
d = r.headers['content-disposition']
fname = re.findall("filename=(.+)", d)[0]
Name extracted from the string via regular expression (re module).