I've successfully downloaded the file from BIM360 using Postman for testing. Now I'm trying to implement this request in Ironpython urllib2 (cause urllib2 is my only choice for this task in the standard library to my knowledge) but I'm getting the error:
Exception : System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
Code:
import urllib2
import shutil
url = 'https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/xxx.txt'
head = {
'User-Agent': 'user-agent',
'Authorization':'Bearer xxx',
'x-user-id':'xxx'}
dst = 'C:\Users\xxx\OneDrive - MyCompany\Desktop\sptext.txt'
req = urllib2.Request(url, headers=head)
with urllib2.urlopen(req) as response:
shutil.copyfileobj(response, dst)
Any help is appreciated.