[gdal-dev] GDAL - Python Bindings - CURL NETRC_FILE

Even Rouault even.rouault at spatialys.com
Sun Mar 12 08:35:00 PDT 2023


You're right, I looked too fast. I've added a GDAL_HTTP_NETRC_FILE 
option in https://github.com/OSGeo/gdal/pull/7435

Le 12/03/2023 à 16:11, Morgan Kerle a écrit :
> HI Even,
>
> Thanks for your reply. I had assume that GDAL_HTTP_NETRC set the 
> option NETRC as in papszOptions which accepts "YES" or "NO" to 
> indicate if ~/.netrc file or $NETRC should be searched for 
> credentials. If this is the same option as CURLOPT_NETRC 
> (https://curl.se/libcurl/c/CURLOPT_NETRC.html), then it does not allow 
> the user to specify a location for the .netrc file. In any case, I 
> attempted setting the GDAL_HTTP_NETRC via gdal.SetConfigOption(), but 
> I am still getting the same curl output (Couldn't find host 
> data.lpdaac.earthdatacloud.nasa.gov 
> <http://data.lpdaac.earthdatacloud.nasa.gov> in the (nil) file; using 
> defaults).
>
> I assume (nil) file should be showing the file path supplied via 
> GDAL_HTTP_NETRC?
>
> Morgan
>
> On Sun, 12 Mar 2023 at 10:58, Even Rouault 
> <even.rouault at spatialys.com> wrote:
>
>     Morgan,
>
>     The right name is GDAL_HTTP_NETRC :
>     https://gdal.org/api/cpl.html#_CPPv412CPLHTTPFetchPKc12CSLConstList
>
>     Even
>
>     GDAL_HTTP_NETRC
>
>     Le 12/03/2023 à 15:49, Morgan Kerle a écrit :
>>     I am trying to use the /vsicurl/ file hander to access a remote
>>     tiff file using basic auth. Is it possible to provide a alternate
>>     location
>>
>>     for a .netrc file via the Python bindings? I have attempted to
>>     use SetConfigOption("CPL_CURL_NETRC_FILE"
>>     "abs/file/path/to/.netrc").
>>
>>     This appears to correctly set the CURL_NETRC_FILE option, as CURL
>>     debugging output shows "Couldn't find host
>>     data.lpdaac.earthdatacloud.nasa.gov
>>     <http://data.lpdaac.earthdatacloud.nasa.gov> in the (nil) file;
>>     using defaults". However, it appears the file is not found /
>>     accessible by libcurl.
>>
>>     Any suggestions as to why this may be the case? I have already
>>     confirmed that the file exists and is accessible, and running
>>     CURL with the same parameters in bash works fine.
>>
>>     Regards,
>>
>>     Morgan
>>
>>     _______________________________________________
>>     gdal-dev mailing list
>>     gdal-dev at lists.osgeo.org
>>     https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>     -- 
>     http://www.spatialys.com
>     My software is free, but my time generally not.
>
-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230312/daa5a1c4/attachment.htm>


More information about the gdal-dev mailing list