https://prefect.io logo
Title
d

darylgunn

02/24/2021, 2:09 PM
Prefect cloud is giving a 403 Security violation response to a POST using httpx (an async http module) to post a mutation (file attached). The call is being made from a FastAPI app, and works fine if I use the requests module. I know Prefect expects synchronous tasks, does this extend to using http on the API calls as well?
j

Jim Crist-Harif

02/24/2021, 3:36 PM
Hi @darylgunn, there's no reason why prefect shouldn't work with httpx (or any other http client). My first guess is you have an `HTTP_PROXY`/`HTTPS_PROXY` set.
requests
picks this up automatically, while
httpx
requires the user to opt-in to respecting these environment variables: https://www.python-httpx.org/environment_variables/#http_proxy-https_proxy-all_proxy
d

darylgunn

02/24/2021, 8:59 PM
Thanks for the reply. None of HTTP_PROXY HTTPS_PROXY or ALL_PROXY are set. (I've checked for them on both the requests and httpx versions of the code). Since there's no reason it shouldn't work for Prefect I know it's an error in my code so I'll keep digging. [edit] It appears to be httpx related, because even the non-async version of the httpx client fails. I can do a GET to https://ifconfig.co ok though. aiohttp has the same security issue so its seems likely it something they're not sending that requests is like you suggested.