diff --git a/lumbunglib/feed.py b/lumbunglib/feed.py index a78c032..f5a8d42 100644 --- a/lumbunglib/feed.py +++ b/lumbunglib/feed.py @@ -194,13 +194,17 @@ def grab_media(post_directory, url, prefered_name=None): """ media_item = urlparse(url).path.split('/')[-1] + headers = { + 'User-Agent': 'https://git.autonomic.zone/ruangrupa/lumbunglib', + 'From': 'info@lumbung.space' # This is another valid field + } if prefered_name: media_item = prefered_name try: if not os.path.exists(os.path.join(post_directory, media_item)): #TODO: stream is true is a conditional so we could check the headers for things, mimetype etc - response = requests.get(url, stream=True) + response = requests.get(url, headers=headers, stream=True) if response.ok: with open(os.path.join(post_directory, media_item), 'wb') as media_file: shutil.copyfileobj(response.raw, media_file)