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

Documentation incorrect for EU and Enterprise customers #224

Open
nathancatania opened this issue Dec 28, 2022 · 0 comments
Open

Documentation incorrect for EU and Enterprise customers #224

nathancatania opened this issue Dec 28, 2022 · 0 comments

Comments

@nathancatania
Copy link

Putting this out there in case other people come across this issue.

Problem

The current documentation for EU and Enterprise customers is incorrect:

For SparkPost EU and Enterprise accounts, pass in a second parameter to set the API host.

from sparkpost import SparkPost
sp = SparkPost('YOUR API KEY', 'https://api.eu.sparkpost.com')

This causes a resolver error:

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: //api.eu.sparkpost.com/api/v1/transmissions (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe226f75630>: Failed to establish a new connection: [Errno -2] Name or service not known'))

Cause

When the second parameter is passed, the constructor appends "https://" to the string (assuming that a domain will be passed and NOT the base URL). This causes the resultant URL to be https://https://api.eu.sparkpost.com/api/v1/transmissions, which causes connectivity failure.

Solution

When passing the API host, drop the https://. Working example:

from sparkpost import SparkPost
sp = SparkPost('YOUR API KEY', 'api.eu.sparkpost.com')
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