developmentseed / landsat-util

A utility to search, download and process Landsat 8 satellite imagery
Creative Commons Zero v1.0 Universal
689 stars 147 forks source link

AUTH_UNAUTHORIZED: Forbidden - Approved role required for access to 'download' method. #247

Closed martingra closed 6 years ago

martingra commented 6 years ago

I keep reciving this error message: AUTH_UNAUTHORIZED: Forbidden - Approved role required for access to 'download' method.

I'm using the following code:

`def landsat(request): path = None # 210 row = None # 50 latitude = -31.345351 longitude = -64.378907 s_date = '2017-11-01' e_date = '2017-12-25' return_scenes = 100 max_cloud_prcnt = 20

srcher = Search()
# dwner = Downloader(verbose=True, download_dir=r"/home/martin/slyagro")
dwner = Downloader(verbose=True, download_dir='/home/martin/slyagro', usgs_user='myUser', usgs_pass='myPass')

if path == None and row == None:
    candidate_scenes = srcher.search(lat=latitude,
                                     lon=longitude,
                                     start_date=s_date,
                                     end_date=e_date,
                                     cloud_min=0,
                                     cloud_max=max_cloud_prcnt,
                                     limit=return_scenes)

if candidate_scenes["status"] == "SUCCESS":
    for scene_image in candidate_scenes["results"]:
        print
        "Downloading:", (str(scene_image['sceneID']))
        dwner.download([str(scene_image['sceneID'])])
        Simple(join(r"/home/martin/slyagro", str(scene_image['sceneID']) + ".tar.bz"))

return render(request, 'satelites/index.html', {})`

In the Downloader constructor, I use the user and pass that I use to login in https://ers.cr.usgs.gov/login/

The user is logged succesfully, but there is an error when trying to donwload data.

JimCircadian commented 6 years ago

I too have recently experienced this error with the command line script

ccazorla commented 6 years ago

You have to ask usgs for a machine to machine access right, if you don't you cannot download from the server. To ask for the rights, send an email to this address: lta@usgs.gov, they will send you a link to a form to fill to get the access.