Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSLError when using URL Slug for dedicated server #117

Open
elrezad opened this issue Jan 15, 2024 · 2 comments
Open

SSLError when using URL Slug for dedicated server #117

elrezad opened this issue Jan 15, 2024 · 2 comments

Comments

@elrezad
Copy link

elrezad commented Jan 15, 2024

Hi team, thank you for this software.

We've recently moved our Knack apps to a dedicated server at apps.mycompany.com. The endpoint for the api should be api.apps.mycompany.com, but when I try to connect it throws an error:

requests.exceptions.SSLError: HTTPSConnectionPool(host='api.apps.mycompany.com-api.knack.com', port=443): Max retries exceeded with url: /v1/applications/60df87fxxxxxxxxxxxxxxxx (Caused by SSLError(CertificateError("hostname 'api.apps.mycompany.com-api.knack.com' doesn't match '*.knack.com'")))

I've contacted Knack's support, but any help would be much appreciated.

Thanks and best regards

@elrezad
Copy link
Author

elrezad commented Jan 16, 2024

Hi Team, here are Knack's comments:

The Knackpy appears to have some sections hardcoded to use the public API endpoint (api.knack.com), however, in these sections, you will need to replace with your endpoint. One example, and there may be other sections (as a 3rd party library, we aren't very familiar or in a position to repair):

the Knackpy codebase and the API URL is hardcoded:

def _url(*, route: str, slug: str = None) -> str:

It would appear then this is where you would need to make the update as wel

l as other areas as well.

I have edited (my apoligies if there's a better way of pointing to the code) api.py>def _url

return ( # f"https://{slug}-api.knack.com/v1{route}" f"https://{slug}/v1{route}" # slug must be the full url if slug else f"https://api.knack.com/v1{route}" )

using as slug the full url of the private domain api.apps.mycompany.com

With this change, I can connect to Knack with knackpy.App(), but I get the following error when using get("object_1"):

File ".venv/lib/python3.11/site-packages/knackpy/api.py", line 172, in _get_paginated_records
res = _request(
[...]
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='MYCOMPANY', port=443): Max retries exceeded with url: /v1/objects/object_10/records/?page=1&rows_per_page=1000 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f09d25ffd90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

@elrezad
Copy link
Author

elrezad commented Jan 23, 2024

Hi Team, any help here would be greatly appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant