filename requests python

# Fetch Filename from a python request
import requests
r = requests.get(url)
r.headers['content-disposition']

3.33
3
IllusiveBrian 18110 points

                                    # headers of a binary file that accepts downloading partial files
{'Server': 'VK', 'Date': 'Wed, 29 Jan 2020 11:47:20 GMT', 'Content-Type': 'application/pdf', 'Content-Length': '9713036', 'Connection': 'keep-alive', 'Last-Modified': 'Mon, 20 Jan 2020 13:01:17 GMT', 'ETag': '"5e25a49d-94358c"', 'Accept-Ranges': 'bytes', 'Expires': 'Wed, 05 Feb 2020 11:47:20 GMT', 'Cache-Control': 'max-age=604800', 'X-Frontend': 'front632904', 'Access-Control-Expose-Headers': 'X-Frontend', 'Access-Control-Allow-Methods': 'GET, HEAD, OPTIONS', 'Access-Control-Allow-Origin': '*', 'Strict-Transport-Security': 'max-age=15768000'}

3.33 (3 Votes)
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source