From eccd79c37307fb62f21d24c29fe5fbf41b0a4b23 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Tue, 7 Mar 2017 23:19:11 +0100 Subject: [PATCH] Add oAuth headers to downloadMedia requests in order to download DM attachments --- filler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/filler.py b/filler.py index 22aba1e..877e350 100755 --- a/filler.py +++ b/filler.py @@ -2,8 +2,8 @@ import argparse, dbtools, filters.filler, requests, setuptools, time, twitools -def downloadMedia(url, tid, mid): - remote = requests.get(url, stream=True) +def downloadMedia(url, tid, mid, two = twitools.twoHelper()): + remote = two.auth.oauth.get(url, auth=two.api.auth.apply_auth()) filename = "media/%s_%i.%s" % (str(tid), int(mid), url.split(".")[-1]) with open(filename, 'wb') as outfile: