Skip to content

Commit

Permalink
chore: Rename project to api_client_framework
Browse files Browse the repository at this point in the history
  • Loading branch information
EnriqueSoria committed Nov 2, 2023
1 parent d548c84 commit c87bf25
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 19 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion examples/random_data_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions examples/random_data_api/endpoints.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
4 changes: 2 additions & 2 deletions examples/random_post_api/client.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -13,4 +13,4 @@ def __init__(self):
self.session = requests.Session()

def create_object(self, data: CreateObjectRequest):
return self._perform_request(CreateObjectEndpoint(data))
return self._perform_request(CreateObjectEndpoint(data))
7 changes: 4 additions & 3 deletions examples/random_post_api/endpoints.py
Original file line number Diff line number Diff line change
@@ -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/"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c87bf25

Please sign in to comment.