<@ULVA73B9P> I'm getting this error when connectin...
# ask-marvin
k
@Marvin I'm getting this error when connecting to the API in Python: ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129) IT has asked for the Port so they can enable it.
m
It looks like you're encountering an SSL certificate verification error while connecting to an API in Python. This usually occurs when the SSL certificate is self-signed or not trusted by the system. Regarding the port you mentioned, it will depend on the specific API you are trying to connect to. Most commonly, APIs use either port 443 for HTTPS or port 80 for HTTP, but the correct port may vary. To better assist you, please provide more context or check the API documentation for the default port used by the service. In the meantime, here's a Python snippet that demonstrates how you can temporarily bypass SSL verification to identify the port:
Copy code
python
import requests

try:
    response = requests.get('<https://your-api-endpoint.com>', verify=False)
    print(response.status_code)
except requests.exceptions.SSLError as e:
    print(f'SSL error: {e}')
Warning: Disabling SSL verification is generally not recommended for production environments as it makes the connection insecure. Once you identify the port and inform your IT department, they can configure the firewall or network settings to enable it. For a more permanent solution, consider installing the correct SSL certificate or configuring your environment to trust the self-signed certificate.
k
@Marvin Whats the port for the Prefect API?
m
The default port for the Prefect API depends on whether you are using Prefect Cloud or a local Prefect server instance: 1. Prefect Cloud: The API URL generally looks like
<https://api.prefect.cloud/api/>
and uses the default HTTPS port
443
. 2. Local Prefect Server: The default API URL is typically
<http://127.0.0.1:4200/api>
, using port
4200
. For configuring your Prefect API URL, you can refer to the guide in the Prefect documentation. If you need further help configuring a local Prefect server or adjusting network settings, please let me know.