Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 8 additions & 9 deletions tests/test_urlbox_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ def test_api_key_not_provided():
with pytest.raises(TypeError) as type_error:
UrlboxClient()

assert (
str(type_error.value)
== "__init__() missing 1 required keyword-only argument: 'api_key'"
assert str(type_error.value).endswith(
"__init__() missing 1 required keyword-only argument: 'api_key'"
)


Expand Down Expand Up @@ -340,7 +339,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(
Expand Down Expand Up @@ -515,7 +514,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(
Expand Down Expand Up @@ -580,7 +579,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,
)
Expand All @@ -593,7 +592,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()

Expand Down Expand Up @@ -621,7 +620,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,
)
Expand Down Expand Up @@ -655,7 +654,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,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_webhook_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 9 additions & 9 deletions urlbox/urlbox_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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(
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -147,7 +147,7 @@ def generate_url(self, options):
In your html template:
<img src="{{ screenshot_url }}"/>

Full options reference: https://urlbox.io/docs/options
Full options reference: https://urlbox.com/docs/options
"""

processed_options, format = self._process_options(options)
Expand Down
2 changes: 1 addition & 1 deletion urlbox/webhook_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
Loading