0

I have a simple GET request to an endpoint on a Flask server using httpx version 0.13.3.

async with httpx.AsyncClient(auth=auth) as client:
    response = await client.get(
                url = f"SOME_URL",
                headers = {
                    SOME HEADERS THAT CONTAINS COOKIES
                }
            )

In AWS EC2, I got an error [Errno 13] Permission denied: '/root/.netrc'. The Flask app is running on user ubuntu and not root. Is there anyway to avoid trying to read .netrc? I couldn't replicate this in local environment, is this an issue with running it using UWSGI or in AWS EC2?

  1. I tried creating .netrc in root directory with chmod 600 and changing owner to ubuntu (the user running the flask app) which is not safe but didn't work with the same error
  2. I tried passing in auth as a tuple to avoid the call for /root/.netrc as i've seen in the library's code and it still didn't work with the same error
  3. I tried explicitly mentioning the path of /root/.netrc but it is only supported in the newer versions of httpx and I do have other library that relies on that specific version.
  4. Tried setting os.environ['NETRC'] = '/path/to/custom/.netrc' but instead I got read timeout errors

0 Answers0