diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..d83a28c --- /dev/null +++ b/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup, find_packages + +setup(name='transcendence_api', version='1.0', packages=find_packages()) diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/Accounts.py b/src/accounts.py similarity index 92% rename from src/Accounts.py rename to src/accounts.py index fe06d64..2f93b55 100644 --- a/src/Accounts.py +++ b/src/accounts.py @@ -1,7 +1,9 @@ -import urls +from src import urls + from requests import Response -class Account: + +class Accounts: def __init__(self, client): self._client = client diff --git a/src/Client.py b/src/client.py similarity index 85% rename from src/Client.py rename to src/client.py index 1d18023..d8e988d 100644 --- a/src/Client.py +++ b/src/client.py @@ -1,18 +1,17 @@ import requests from requests import Response, Request, Session -import Profiles -import Accounts - -import urls +from src.profiles import Profiles +from src.accounts import Accounts +from src import urls class Client: def __init__(self, url: str): self.url: str = url self.token: str = None self.session: Session = Session() - self.accounts: Account = Accounts.Account(self) - self.profiles = Profiles.Profiles(self) + self.accounts: Accounts = Accounts(self) + self.profiles: Profiles = Profiles(self) def is_authentificate(self): return (not self.token is None) diff --git a/src/Profile.py b/src/profile.py similarity index 100% rename from src/Profile.py rename to src/profile.py diff --git a/src/Profiles.py b/src/profiles.py similarity index 78% rename from src/Profiles.py rename to src/profiles.py index e23caff..4b2db11 100644 --- a/src/Profiles.py +++ b/src/profiles.py @@ -1,8 +1,9 @@ -import urls -import Client +from src import urls + +from src.profile import Profile + from requests import Response -import Profile class Profiles: @@ -14,4 +15,4 @@ class Profiles: if response.status_code == 404: return None content: dict = eval(response.content) - return Profile.Profile(data = content) \ No newline at end of file + return Profile(data = content) \ No newline at end of file diff --git a/src/tests.py b/tests/tests.py similarity index 77% rename from src/tests.py rename to tests/tests.py index 675578a..37e67e0 100644 --- a/src/tests.py +++ b/tests/tests.py @@ -1,6 +1,11 @@ -import Client -import Profile -from urls import * +import os +import sys +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) # Add parent directory to system path + +from src.client import Client +from src.profiles import Profiles +from src.profile import Profile +from src import urls from uuid import uuid4 import os @@ -42,7 +47,7 @@ def test_profile_get(client): print ("GET") - test(client.profiles.get(1), Profile.Profile(username="997e13f5-474d-4fea-b55a-ad8a27b9534b", title=""), "normal") + test(client.profiles.get(1), Profile(username="997e13f5-474d-4fea-b55a-ad8a27b9534b", title=""), "normal") print() @@ -51,7 +56,7 @@ def tests(): username = uuid4() password = uuid4() - client = Client.Client("http://0.0.0.0:8000/") + client = Client("http://0.0.0.0:8000/") print("ACCOUNTS".center(os.get_terminal_size()[0], '-')) test_accounts_register(client, username, password)