Add oAuth headers to downloadMedia requests in order to download DM attachments

This commit is contained in:
Klaus-Uwe Mitterer 2017-03-07 23:19:11 +01:00
parent fcbef05348
commit eccd79c373

View file

@ -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: