diff --git a/README.md b/README.md index c614f1d..e64ef10 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ Create clients for consuming endpoints in a class-based way. ## Describe the endpoints using a class ```python -from api_consumer.requests import RequestsEndpoint -from api_consumer.requests import Methods -from api_consumer.parsers import NamedTupleParser +from api_client_framework.requests import RequestsEndpoint +from api_client_framework.requests import Methods +from api_client_framework.parsers import NamedTupleParser from collections import namedtuple User = namedtuple("User", ["id", "uid", "password","first_name", ...], rename=True) @@ -25,7 +25,7 @@ import requests from examples.random_data_api.endpoints import UsersEndpoint from examples.random_data_api.models import User -from api_consumer.requests import RequestsClient +from api_client_framework.requests import RequestsClient class RandomDataAPI(RequestsClient): diff --git a/examples/random_data_api/client.py b/examples/random_data_api/client.py index 9c9a00f..3809330 100644 --- a/examples/random_data_api/client.py +++ b/examples/random_data_api/client.py @@ -4,7 +4,7 @@ from examples.random_data_api.endpoints import UsersEndpoint from examples.random_data_api.models import Beer from examples.random_data_api.models import User -from api_consumer.requests import RequestsClient +from api_client_framework.requests import RequestsClient class RandomDataAPI(RequestsClient): diff --git a/examples/random_data_api/endpoints.py b/examples/random_data_api/endpoints.py index 491e88c..4b29624 100644 --- a/examples/random_data_api/endpoints.py +++ b/examples/random_data_api/endpoints.py @@ -1,8 +1,8 @@ from examples.random_data_api.models import Beer from examples.random_data_api.models import User -from api_consumer.methods import Methods -from api_consumer.parsers import NamedTupleParser -from api_consumer.requests import RequestsEndpoint +from api_client_framework.methods import Methods +from api_client_framework.parsers import NamedTupleParser +from api_client_framework.requests import RequestsEndpoint class UsersEndpoint(RequestsEndpoint): diff --git a/examples/random_post_api/client.py b/examples/random_post_api/client.py index 6c8c885..906492f 100644 --- a/examples/random_post_api/client.py +++ b/examples/random_post_api/client.py @@ -1,6 +1,6 @@ import requests -from api_consumer.requests import RequestsClient +from api_client_framework.requests import RequestsClient from examples.random_post_api.endpoints import CreateObjectEndpoint from examples.random_post_api.models import CreateObjectRequest @@ -13,4 +13,4 @@ def __init__(self): self.session = requests.Session() def create_object(self, data: CreateObjectRequest): - return self._perform_request(CreateObjectEndpoint(data)) \ No newline at end of file + return self._perform_request(CreateObjectEndpoint(data)) diff --git a/examples/random_post_api/endpoints.py b/examples/random_post_api/endpoints.py index 4972608..1270608 100644 --- a/examples/random_post_api/endpoints.py +++ b/examples/random_post_api/endpoints.py @@ -1,9 +1,10 @@ -from api_consumer.methods import Methods -from api_consumer.parsers import NamedTupleParser -from api_consumer.requests import RequestsEndpoint +from api_client_framework.methods import Methods +from api_client_framework.parsers import NamedTupleParser +from api_client_framework.requests import RequestsEndpoint from examples.random_post_api.models import CreateObjectRequest + class CreateObjectEndpoint(RequestsEndpoint): method = Methods.POST url = "https://api.restful-api.dev/objects/" diff --git a/pyproject.toml b/pyproject.toml index 64f7775..1d958b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.poetry] -name = "api_consumer" +name = "api_client_framework" version = "0.1.0" description = "Class-based helper for constructing API clients" authors = ["EnriqueSoria "] diff --git a/src/api_consumer/__init__.py b/src/api_client_framework/__init__.py similarity index 100% rename from src/api_consumer/__init__.py rename to src/api_client_framework/__init__.py diff --git a/src/api_consumer/methods.py b/src/api_client_framework/methods.py similarity index 100% rename from src/api_consumer/methods.py rename to src/api_client_framework/methods.py diff --git a/src/api_consumer/parsers.py b/src/api_client_framework/parsers.py similarity index 93% rename from src/api_consumer/parsers.py rename to src/api_client_framework/parsers.py index 039c1f2..11f94c8 100644 --- a/src/api_consumer/parsers.py +++ b/src/api_client_framework/parsers.py @@ -2,7 +2,7 @@ from typing import NamedTuple from typing import Type -from api_consumer.protocols import Parser +from api_client_framework.protocols import Parser class NoOpParser(Parser): diff --git a/src/api_consumer/protocols.py b/src/api_client_framework/protocols.py similarity index 100% rename from src/api_consumer/protocols.py rename to src/api_client_framework/protocols.py diff --git a/src/api_consumer/requests.py b/src/api_client_framework/requests.py similarity index 89% rename from src/api_consumer/requests.py rename to src/api_client_framework/requests.py index 8d77abd..ab6d4da 100644 --- a/src/api_consumer/requests.py +++ b/src/api_client_framework/requests.py @@ -4,10 +4,10 @@ import requests -from api_consumer.methods import Methods -from api_consumer.parsers import NoOpParser -from api_consumer.protocols import Parser -from api_consumer.protocols import EndpointProtocol +from api_client_framework.methods import Methods +from api_client_framework.parsers import NoOpParser +from api_client_framework.protocols import Parser +from api_client_framework.protocols import EndpointProtocol class ExceptionReRaiser: