Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@
"outputs": [],
"source": [
"# Download an image.\n",
"d = requests.get(\"https://www.paristoolkit.com/Images/xeffel_view.jpg.pagespeed.ic.8XcZNqpzSj.jpg\")\n",
"# The previous host stopped serving this image. Wikimedia Commons has a stable\n",
"# copy, but requires a descriptive User-Agent rather than the requests default.\n",
"headers = {\"User-Agent\": \"TensorFlow-Examples (https://github.com/aymericdamien/TensorFlow-Examples)\"}\n",
"url = \"https://upload.wikimedia.org/wikipedia/commons/8/85/Tour_Eiffel_Wikimedia_Commons_%28cropped%29.jpg\"\n",
"d = requests.get(url, headers=headers, timeout=30)\n",
"d.raise_for_status()\n",
"with open(\"image.jpeg\", \"wb\") as f:\n",
" f.write(d.content)"
]
Expand Down