Add oAuth headers to downloadMedia requests in order to download DM attachments
This commit is contained in:
parent
fcbef05348
commit
eccd79c373
1 changed files with 2 additions and 2 deletions
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
import argparse, dbtools, filters.filler, requests, setuptools, time, twitools
|
import argparse, dbtools, filters.filler, requests, setuptools, time, twitools
|
||||||
|
|
||||||
def downloadMedia(url, tid, mid):
|
def downloadMedia(url, tid, mid, two = twitools.twoHelper()):
|
||||||
remote = requests.get(url, stream=True)
|
remote = two.auth.oauth.get(url, auth=two.api.auth.apply_auth())
|
||||||
filename = "media/%s_%i.%s" % (str(tid), int(mid), url.split(".")[-1])
|
filename = "media/%s_%i.%s" % (str(tid), int(mid), url.split(".")[-1])
|
||||||
|
|
||||||
with open(filename, 'wb') as outfile:
|
with open(filename, 'wb') as outfile:
|
||||||
|
|
Loading…
Reference in a new issue