0

I'm relatively new to Python and have been left scratching my head now for a few days whilst trying to resolve what I feel should be a relatively straightforward task.

The aim is to connect to a corporate SharePoint site (i.e. xxxxx.sharepoint.com) and download a CSV file that's stored there to somewhere on the network (or even local system).

The file can be found in the following location. If I copy and paste it in to a the web address field it downloads the file perfectly:

https://xxxxxx.sharepoint.com/sites/MSS/im/pa/ReportData/DirectorMap.csv

However, try as I might, I cannot seem to download it via a Python script. I believe we are behind a proxy server (no credentials required):

https://example.proxy.com:8080

I've tried using requests, requests_ntlm, sharepoint, urllib3 etc etc but constantly get a "403: Forbidden" error. I have tried passing it my own credentials (and given the file was created by myself on SharePoint I can't see that it would be down to me genuinely not having access).

Is anyone able to post a script that will achieve my aims, based on the proxy and url I've posted above?

jmd_dk
  • 12,125
  • 9
  • 63
  • 94
Ben
  • 1
  • Welcome to Stackoverflow! You've got two questions: how to properly use the proxy and how to interface Sharepoint. Please pick one and edit your question. – Allison Oct 30 '17 at 16:42

1 Answers1

0

Sounds like your python isn't picking up the assumed Windows proxy environment (presumably you are behind something like a corporate firewall).

The solution is to use cntlm which will allow you to tunnel your existing connections through a local proxy.

See this Q&A for more info on setting CNTLM up

zglin
  • 2,891
  • 2
  • 15
  • 26