diff --git a/README.md b/README.md index d3abb22..a9887ed 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ![Tests](https://github.com/urlbox/urlbox-python/actions/workflows/tests.yml/badge.svg) ![Linter](https://github.com/urlbox/urlbox-python/actions/workflows/linters.yml/badge.svg) -The Urlbox Python library provides easy access to the Urlbox website screenshot API from your Python application. +The Urlbox Python library provides easy access to the Urlbox website screenshot API from your Python application. Now there's no need to muck around with http clients, etc... @@ -14,7 +14,7 @@ Just initialise the UrlboxClient and make a screenshot of a URL in seconds. ## Documentation -See the Urlbox API Docs. +See the Urlbox API Docs. ## Requirements @@ -27,7 +27,7 @@ Python 3.x ## Usage -First, grab your Urlbox API key* found in your Urlbox Dashboard, to initialise the UrlboxClient instance. +First, grab your Urlbox API key* found in your Urlbox Dashboard, to initialise the UrlboxClient instance. *\* and grab your API secret - if you want to make authenticated requests. Requests will be automatically authenticated when you supply YOUR_API_SECRET. So you really should.* @@ -76,7 +76,7 @@ Additional options in the dictionary include: "format" can be either: png, jpg or jpeg, avif, webp ,pdf, svg, html *(defaults to png if not provided).* "full_page", "width", and many more. -See all available options here: https://urlbox.io/docs/options +See all available options here: https://urlbox.com/docs/options eg: ```python @@ -172,7 +172,7 @@ Give it a couple of seconds, and you should receive, posted to the webhook_url s "event": "render.succeeded", "renderId": "2cf5ffe2-7736-4d41-8c30-f13e16d35248", "result": { - "renderUrl": "https://renders.urlbox.io/urlbox1/renders/61431b47b8538a00086c29dd/2021/11/25/e2dcec18-8353-435c-ba17-b549c849eec5.png" + "renderUrl": "https://renders.urlbox.com/urlbox1/renders/61431b47b8538a00086c29dd/2021/11/25/e2dcec18-8353-435c-ba17-b549c849eec5.png" }, "meta": { "startTime": "2021-11-25T16:32:32.453Z", @@ -203,7 +203,7 @@ payload = { "event": "render.succeeded", "renderId": "794383cd-b09e-4aef-a12b-fadf8aad9d63", "result": { - "renderUrl": "https://renders.urlbox.io/urlbox1/renders/foo.png" + "renderUrl": "https://renders.urlbox.com/urlbox1/renders/foo.png" }, "meta": { "startTime": "2021-11-24T16:49:48.307Z", @@ -224,4 +224,4 @@ webhook_validator.call(header_signature, payload, webhook_secret) ## Feedback -Feel free to contact us if you spot a bug or have any suggestions at: support`[at]`urlbox.io. +Feel free to contact us if you spot a bug or have any suggestions at: support`[at]`urlbox.com. diff --git a/setup.py b/setup.py index ad86fbb..f5b9ce0 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ name="urlbox", version="1.0.6", author="Urlbox", - author_email="support@urlbox.io", + author_email="support@urlbox.com", description="Official Python client for the Ulrbox API", license="MIT", long_description=long_description, diff --git a/tests/test_urlbox_client.py b/tests/test_urlbox_client.py index 3f6c7bd..a9e84fc 100644 --- a/tests/test_urlbox_client.py +++ b/tests/test_urlbox_client.py @@ -36,9 +36,10 @@ def test_api_key_not_provided(): with pytest.raises(TypeError) as type_error: UrlboxClient() + # Required UrlboxClient. as prefix to pass tests locally for python@3.11.6 assert ( str(type_error.value) - == "__init__() missing 1 required keyword-only argument: 'api_key'" + == "UrlboxClient.__init__() missing 1 required keyword-only argument: 'api_key'" ) @@ -340,7 +341,7 @@ def test_get_invalid_url(): def test_get_with_different_host_name(): - api_host_name = random.choice(["api-eu.urlbox.io", "api-direct.urlbox.io"]) + api_host_name = random.choice(["api-eu.urlbox.com", "api-direct.urlbox.com"]) api_key = fake.pystr() format = random.choice( @@ -515,7 +516,7 @@ def test_head_request(): def test_head_with_different_host_name(): - api_host_name = random.choice(["api-eu.urlbox.io", "api-direct.urlbox.io"]) + api_host_name = random.choice(["api-eu.urlbox.com", "api-direct.urlbox.com"]) api_key = fake.pystr() format = random.choice( @@ -580,7 +581,7 @@ def test_post_request_successful(): with requests_mock.Mocker() as requests_mocker: requests_mocker.post( urlbox_request_url, - content=b'{"status":"created","renderId":"47dd4b7b-1eea-437c-ade0-f2d1cd7bf5a1","statusUrl":"https://api.urlbox.io/render/47dd4b7b-1eea-437c-ade0-f2d1cd7bf5a1"}', + content=b'{"status":"created","renderId":"47dd4b7b-1eea-437c-ade0-f2d1cd7bf5a1","statusUrl":"https://api.urlbox.com/render/47dd4b7b-1eea-437c-ade0-f2d1cd7bf5a1"}', headers={"content-type": "application/json"}, status_code=201, ) @@ -593,7 +594,7 @@ def test_post_request_successful(): def test_post_with_different_host_name(): - api_host_name = random.choice(["api-eu.urlbox.io", "api-direct.urlbox.io"]) + api_host_name = random.choice(["api-eu.urlbox.com", "api-direct.urlbox.com"]) api_key = fake.pystr() api_secret = fake.pystr() @@ -621,7 +622,7 @@ def test_post_with_different_host_name(): with requests_mock.Mocker() as requests_mocker: requests_mocker.post( urlbox_request_url, - content=b'{"status":"created","renderId":"47dd4b7b-1eea-437c-ade0-f2d1cd7bf5a1","statusUrl":"https://api.urlbox.io/render/47dd4b7b-1eea-437c-ade0-f2d1cd7bf5a1"}', + content=b'{"status":"created","renderId":"47dd4b7b-1eea-437c-ade0-f2d1cd7bf5a1","statusUrl":"https://api.urlbox.com/render/47dd4b7b-1eea-437c-ade0-f2d1cd7bf5a1"}', headers={"content-type": "application/json"}, status_code=201, ) @@ -655,7 +656,7 @@ def test_post_request_successful_missing_webhook_url(): with requests_mock.Mocker() as requests_mocker: requests_mocker.post( urlbox_request_url, - content=b'{"status":"created","renderId":"47dd4b7b-1eea-437c-ade0-f2d1cd7bf5a1","statusUrl":"https://api.urlbox.io/render/47dd4b7b-1eea-437c-ade0-f2d1cd7bf5a1"}', + content=b'{"status":"created","renderId":"47dd4b7b-1eea-437c-ade0-f2d1cd7bf5a1","statusUrl":"https://api.urlbox.com/render/47dd4b7b-1eea-437c-ade0-f2d1cd7bf5a1"}', headers={"content-type": "application/json"}, status_code=201, ) diff --git a/tests/test_webhook_validator.py b/tests/test_webhook_validator.py index b1faa8a..190214a 100644 --- a/tests/test_webhook_validator.py +++ b/tests/test_webhook_validator.py @@ -23,7 +23,7 @@ "event": "render.succeeded", "renderId": "794383cd-b09e-4aef-a12b-fadf8aad9d63", "result": { - "renderUrl": "https://renders.urlbox.io/urlbox1/renders/61431b47b8538a00086c29dd/2021/11/24/bee42850-bab6-43c6-bd9d-e614581d31b4.png" + "renderUrl": "https://renders.urlbox.com/urlbox1/renders/61431b47b8538a00086c29dd/2021/11/24/bee42850-bab6-43c6-bd9d-e614581d31b4.png" }, "meta": { "startTime": "2021-11-24T16:49:48.307Z", diff --git a/urlbox/urlbox_client.py b/urlbox/urlbox_client.py index 103c50c..be04cf4 100644 --- a/urlbox/urlbox_client.py +++ b/urlbox/urlbox_client.py @@ -13,14 +13,14 @@ class UrlboxClient: The core client object used to interact with the Urlbox API :param api_key: Your API key found in your Urlbox Dashboard - `https://urlbox.io/dashboard/api` + `https://urlbox.com/dashboard/api` :param api_secret: (Optional) Your API secret found in your Urlbox - Dashboard`https://urlbox.io/dashboard/api` + Dashboard`https://urlbox.com/dashboard/api` Required for authenticated requests. """ - BASE_API_URL = "https://api.urlbox.io/v1/" + BASE_API_URL = "https://api.urlbox.com/v1/" POST_END_POINT = "render" def __init__(self, *, api_key, api_secret=None, api_host_name=None): @@ -38,8 +38,8 @@ def get(self, options): format: can be either "png", "jpg", "jpeg", "avif", "webp", "pdf", "svg", "html". Defaults to "png". Example: urlbox_client.get({"url": "http://example.com/", "format": "png", "full_page": True, "width": 300}) - API example: https://urlbox.io/docs/getting-started - Full options reference: https://urlbox.io/docs/options + API example: https://urlbox.com/docs/getting-started + Full options reference: https://urlbox.com/docs/options """ return requests.get( @@ -78,8 +78,8 @@ def head(self, options): format: can be either "png", "jpg", "jpeg", "avif", "webp", "pdf", "svg", "html". Defaults to "png". Example: urlbox_client.get({"url": "http://example.com/", "format": "png", "full_page": True, "width": 300}) - API example: https://urlbox.io/docs/getting-started - Full options reference: https://urlbox.io/docs/options + API example: https://urlbox.com/docs/getting-started + Full options reference: https://urlbox.com/docs/options """ processed_options, format = self._process_options(options) @@ -104,7 +104,7 @@ def post(self, options): format: can be either "png", "jpg", "jpeg", "avif", "webp", "pdf", "svg", "html". Defaults to "png". Example: urlbox_client.post({"url": "http://example.com/", "webhook_url": "http://yoursite.com/webhook", "format": "png", "full_page": True, "width": 300}) - Full options reference: https://urlbox.io/docs/options + Full options reference: https://urlbox.com/docs/options """ if "webhook_url" not in options: @@ -147,7 +147,7 @@ def generate_url(self, options): In your html template: - Full options reference: https://urlbox.io/docs/options + Full options reference: https://urlbox.com/docs/options """ processed_options, format = self._process_options(options) diff --git a/urlbox/webhook_validator.py b/urlbox/webhook_validator.py index 4b6fe28..fa4e2d6 100644 --- a/urlbox/webhook_validator.py +++ b/urlbox/webhook_validator.py @@ -19,7 +19,7 @@ def call(header_signature, payload, webhook_secret): :param payload: json body of the webhook request. :param webhook_secret: Your webhook secret found in your Urlbox (NB: NOT the api secret - that's a different secret) - Dashboard`https://urlbox.io/dashboard/api` + Dashboard`https://urlbox.com/dashboard/api` This function parses the signature value to determine if it's part of a valid Urlbox webhook request. """