From b3543dd887ff357a9148424732ed3b5dae4802e0 Mon Sep 17 00:00:00 2001 From: Simone Carletti <5387+weppos@users.noreply.github.com> Date: Mon, 12 Jan 2026 22:26:26 +0100 Subject: [PATCH] Removed deprecated getDomainPremiumPrice Ref: https://github.com/dnsimple/dnsimple-developer/pull/916 --- CHANGELOG.md | 2 ++ dnsimple/service/registrar.py | 29 +------------------ dnsimple/struct/__init__.py | 1 - dnsimple/struct/domain_premium_price.py | 27 ----------------- .../error_400_not_a_premium_domain.http | 18 ------------ .../error_400_tld_not_supported.http | 18 ------------ .../api/checkDomainPremiumPrice/success.http | 20 ------------- .../v2/api/getDomainPremiumPrice/failure.http | 15 ---------- .../v2/api/getDomainPremiumPrice/success.http | 20 ------------- tests/service/registrar_test.py | 29 +------------------ 10 files changed, 4 insertions(+), 175 deletions(-) delete mode 100644 dnsimple/struct/domain_premium_price.py delete mode 100644 tests/fixtures/v2/api/checkDomainPremiumPrice/error_400_not_a_premium_domain.http delete mode 100644 tests/fixtures/v2/api/checkDomainPremiumPrice/error_400_tld_not_supported.http delete mode 100644 tests/fixtures/v2/api/checkDomainPremiumPrice/success.http delete mode 100644 tests/fixtures/v2/api/getDomainPremiumPrice/failure.http delete mode 100644 tests/fixtures/v2/api/getDomainPremiumPrice/success.http diff --git a/CHANGELOG.md b/CHANGELOG.md index f5c67af4..75ec47fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/). ## main +- REMOVED: Removed deprecated `get_domain_premium_price`. Use `get_domain_prices` instead. + ## 6.1.0 - NEW: Added `Zones.batch_change_records` to make changes to zone records in a batch. (dnsimple/dnsimple-python#477) diff --git a/dnsimple/service/registrar.py b/dnsimple/service/registrar.py index 34f0239f..37c971c1 100644 --- a/dnsimple/service/registrar.py +++ b/dnsimple/service/registrar.py @@ -1,8 +1,7 @@ import json -import warnings from dnsimple.response import Response -from dnsimple.struct import DomainCheck, DomainPremiumPrice, DomainRegistration, DomainTransfer, DomainRenewal, DomainRestore, RegistrantChange, VanityNameServer, WhoisPrivacy, WhoisPrivacyRenewal, DomainPrice, CheckRegistrantChangeInput, CreateRegistrantChangeInput, RegistrantChangeCheck, DomainTransferLock +from dnsimple.struct import DomainCheck, DomainRegistration, DomainTransfer, DomainRenewal, DomainRestore, RegistrantChange, VanityNameServer, WhoisPrivacy, WhoisPrivacyRenewal, DomainPrice, CheckRegistrantChangeInput, CreateRegistrantChangeInput, RegistrantChangeCheck, DomainTransferLock class Registrar(object): @@ -32,32 +31,6 @@ def check_domain(self, account_id, domain): response = self.client.get(f'/{account_id}/registrar/domains/{domain}/check') return Response(response, DomainCheck) - def get_domain_premium_price(self, account_id, domain, options=None): - """ - DEPERECATED: Get the premium price for a domain. - Use get_domain_prices - - See https://developer.dnsimple.com/v2/registrar/#getDomainPremiumPrice - - :param account_id: int - The account ID - :param domain: str - The domain name - :param options: dnsimple.struct.DomainPremiumPriceOptions - Optional action between "registration", "renewal", and "transfer". - If omitted, it defaults to "registration". - - :return: dnsimple.Response - The domain premium price requested - """ - - warnings.warn("DEPRECATION WARNING: get_domain_premium_price is deprecated, use get_domain_prices instead.") - - if options is None: - options = {} - response = self.client.get(f'/{account_id}/registrar/domains/{domain}/premium_price', params=options) - return Response(response, DomainPremiumPrice) - def get_domain_prices(self, account_id, domain): """ Get prices for a domain. diff --git a/dnsimple/struct/__init__.py b/dnsimple/struct/__init__.py index 17a4632b..44a9700b 100644 --- a/dnsimple/struct/__init__.py +++ b/dnsimple/struct/__init__.py @@ -9,7 +9,6 @@ from dnsimple.struct.delegation_signer_record import DelegationSignerRecord, DelegationSignerRecordInput from dnsimple.struct.domain import Domain from dnsimple.struct.domain_check import DomainCheck -from dnsimple.struct.domain_premium_price import DomainPremiumPrice, DomainPremiumPriceOptions from dnsimple.struct.domain_price import DomainPrice from dnsimple.struct.domain_registration import DomainRegistration, DomainRegistrationRequest from dnsimple.struct.domain_renewal import DomainRenewal, DomainRenewRequest diff --git a/dnsimple/struct/domain_premium_price.py b/dnsimple/struct/domain_premium_price.py deleted file mode 100644 index 4c2b0648..00000000 --- a/dnsimple/struct/domain_premium_price.py +++ /dev/null @@ -1,27 +0,0 @@ -from dataclasses import dataclass - -from dnsimple.struct import Struct - - -@dataclass -class DomainPremiumPrice(Struct): - """ - DomainPremiumPrice represents the premium price for a premium domain. - """ - - premium_price = None - """The domain premium price""" - action = None - """The action (either registration, transfer or renewal)""" - - def __init__(self, data): - super().__init__(data) - - -class DomainPremiumPriceOptions(dict): - """ - DomainPremiumPriceOptions specifies the optional parameters you can provide to customize the - dnsimple.services.Registrar.get_domain_premium_price method. - """ - def __init__(self, action=None): - dict.__init__(self, action=action) diff --git a/tests/fixtures/v2/api/checkDomainPremiumPrice/error_400_not_a_premium_domain.http b/tests/fixtures/v2/api/checkDomainPremiumPrice/error_400_not_a_premium_domain.http deleted file mode 100644 index 62263a37..00000000 --- a/tests/fixtures/v2/api/checkDomainPremiumPrice/error_400_not_a_premium_domain.http +++ /dev/null @@ -1,18 +0,0 @@ -HTTP/1.1 400 Bad Request -Server: nginx -Date: Mon, 27 Jul 2020 13:43:02 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 4800 -X-RateLimit-Remaining: 4786 -X-RateLimit-Reset: 1595859922 -Cache-Control: no-cache -X-Request-Id: 382b409c-0f90-4758-af3b-0bccd31a9d0d -X-Runtime: 1.346405 -X-Frame-Options: DENY -X-Content-Type-Options: nosniff -X-XSS-Protection: 1; mode=block -X-Download-Options: noopen -X-Permitted-Cross-Domain-Policies: none - -{"message":"`cocotero.love` is not a premium domain for registration"} diff --git a/tests/fixtures/v2/api/checkDomainPremiumPrice/error_400_tld_not_supported.http b/tests/fixtures/v2/api/checkDomainPremiumPrice/error_400_tld_not_supported.http deleted file mode 100644 index 7cb72d8d..00000000 --- a/tests/fixtures/v2/api/checkDomainPremiumPrice/error_400_tld_not_supported.http +++ /dev/null @@ -1,18 +0,0 @@ -HTTP/1.1 400 Bad Request -Server: nginx -Date: Mon, 27 Jul 2020 13:41:23 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 2400 -X-RateLimit-Remaining: 2398 -X-RateLimit-Reset: 1595860823 -Cache-Control: no-cache -X-Request-Id: 6986cca3-4f57-4814-9e81-1c484d61c7ea -X-Runtime: 0.007339 -X-Frame-Options: DENY -X-Content-Type-Options: nosniff -X-XSS-Protection: 1; mode=block -X-Download-Options: noopen -X-Permitted-Cross-Domain-Policies: none - -{"message":"TLD .LOVE is not supported"} diff --git a/tests/fixtures/v2/api/checkDomainPremiumPrice/success.http b/tests/fixtures/v2/api/checkDomainPremiumPrice/success.http deleted file mode 100644 index a37ddadc..00000000 --- a/tests/fixtures/v2/api/checkDomainPremiumPrice/success.http +++ /dev/null @@ -1,20 +0,0 @@ -HTTP/1.1 200 OK -Server: nginx -Date: Mon, 27 Jul 2020 13:58:50 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 4800 -X-RateLimit-Remaining: 4769 -X-RateLimit-Reset: 1595859923 -ETag: W/"54b4776b898065f2f551fc33465d0936" -Cache-Control: max-age=0, private, must-revalidate -X-Request-Id: 75c5090e-8000-4e95-a516-ffd09383f641 -X-Runtime: 2.380524 -X-Frame-Options: DENY -X-Content-Type-Options: nosniff -X-XSS-Protection: 1; mode=block -X-Download-Options: noopen -X-Permitted-Cross-Domain-Policies: none -Strict-Transport-Security: max-age=31536000 - -{"data":{"premium_price":"2640.00","action":"registration"}} diff --git a/tests/fixtures/v2/api/getDomainPremiumPrice/failure.http b/tests/fixtures/v2/api/getDomainPremiumPrice/failure.http deleted file mode 100644 index 5a8530e4..00000000 --- a/tests/fixtures/v2/api/getDomainPremiumPrice/failure.http +++ /dev/null @@ -1,15 +0,0 @@ -HTTP/1.1 400 Bad Request -Server: nginx -Date: Tue, 22 Nov 2016 10:48:27 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -Cache-Control: no-cache -X-Request-Id: 1304138f-0fc7-4845-b9ed-e3803409cb5a -X-Runtime: 1.421413 -X-Content-Type-Options: nosniff -X-Download-Options: noopen -X-Frame-Options: DENY -X-Permitted-Cross-Domain-Policies: none -X-XSS-Protection: 1; mode=block - -{"message":"`example.com` is not a premium domain for registration"} diff --git a/tests/fixtures/v2/api/getDomainPremiumPrice/success.http b/tests/fixtures/v2/api/getDomainPremiumPrice/success.http deleted file mode 100644 index 3307085e..00000000 --- a/tests/fixtures/v2/api/getDomainPremiumPrice/success.http +++ /dev/null @@ -1,20 +0,0 @@ -HTTP/1.1 200 OK -Server: nginx -Date: Tue, 22 Nov 2016 10:46:17 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 2400 -X-RateLimit-Remaining: 2399 -X-RateLimit-Reset: 1479815177 -ETag: W/"7ed6ab997deeafd985a5782df2d86b04" -Cache-Control: max-age=0, private, must-revalidate -X-Request-Id: 54731b91-cd76-4d08-9481-c0f55f47996d -X-Runtime: 1.013083 -X-Content-Type-Options: nosniff -X-Download-Options: noopen -X-Frame-Options: DENY -X-Permitted-Cross-Domain-Policies: none -X-XSS-Protection: 1; mode=block -Strict-Transport-Security: max-age=31536000 - -{"data":{"premium_price":"109.00","action":"registration"}} diff --git a/tests/service/registrar_test.py b/tests/service/registrar_test.py index 99736cf9..ad748690 100644 --- a/tests/service/registrar_test.py +++ b/tests/service/registrar_test.py @@ -3,7 +3,7 @@ import responses from dnsimple import DNSimpleException -from dnsimple.struct import DomainPremiumPriceOptions, DomainTransferRequest, DomainRenewRequest, DomainRestoreRequest +from dnsimple.struct import DomainTransferRequest, DomainRenewRequest, DomainRestoreRequest from dnsimple.struct.domain_registration import DomainRegistrationRequest from tests.helpers import DNSimpleMockResponse, DNSimpleTest @@ -20,16 +20,6 @@ def test_check_domain(self): self.assertTrue(domain_check.available) self.assertTrue(domain_check.premium) - @responses.activate - def test_check_domain_premium_price(self): - responses.add(DNSimpleMockResponse(method=responses.GET, - path='/1010/registrar/domains/ruby.codes/premium_price', - fixture_name='getDomainPremiumPrice/success')) - domain_premium_price = self.registrar.get_domain_premium_price(1010, 'ruby.codes').data - - self.assertEqual('109.00', domain_premium_price.premium_price) - self.assertEqual('registration', domain_premium_price.action) - @responses.activate def test_get_domain_prices(self): responses.add(DNSimpleMockResponse(method=responses.GET, @@ -84,23 +74,6 @@ def test_get_domain_renewal(self): self.assertEqual(domain_renewal.created_at, "2016-12-09T19:46:45Z") self.assertEqual(domain_renewal.updated_at, "2016-12-12T19:46:45Z") - @responses.activate - def test_check_domain_premium_price_passing_action(self): - responses.add(DNSimpleMockResponse(method=responses.GET, - path='/1010/registrar/domains/ruby.codes/premium_price?action=registration', - fixture_name='getDomainPremiumPrice/success')) - self.registrar.get_domain_premium_price(1010, 'ruby.codes', DomainPremiumPriceOptions(action='registration')) - - @responses.activate - def test_check_domain_premium_price(self): - responses.add(DNSimpleMockResponse(method=responses.GET, - path='/1010/registrar/domains/example.com/premium_price', - fixture_name='getDomainPremiumPrice/failure')) - try: - self.registrar.get_domain_premium_price(1010, 'example.com') - except DNSimpleException as dnse: - self.assertEqual('`example.com` is not a premium domain for registration', dnse.message) - @responses.activate def test_register_domain(self): responses.add(DNSimpleMockResponse(method=responses.POST,