Created
February 2, 2024 05:00
-
-
Save anandadake/0ae3e4e165f0bfac07b4f56d13be2918 to your computer and use it in GitHub Desktop.
Python Flask: send file from other link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| def get(cls, date: str, date_end: str, office_in_charge: str): | |
| user = get_jwt_identity() | |
| url = "http://localhost:9090/jasperserver/rest_v2/reports/reports/interactive/DTR.pdf" | |
| r = requests.get(url, | |
| params={ | |
| 'username': 'jasperadmin', | |
| 'password': 'jasperadmin', | |
| 'p1': user, | |
| 'p2': user, | |
| 'date': date, | |
| 'date_end': date_end, | |
| 'office_in_charge': office_in_charge | |
| } | |
| , allow_redirects=True) | |
| return send_file(r.content, as_attachment=True, mimetype='application/pdf') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment