diff --git a/__init__.py b/__init__.py deleted file mode 100644 index ca57869..0000000 --- a/__init__.py +++ /dev/null @@ -1 +0,0 @@ -import apiclient diff --git a/testing.py b/testing.py index 117db5f..341e90b 100644 --- a/testing.py +++ b/testing.py @@ -1,7 +1,7 @@ """ Demonstrate basic usage """ -from apiclient import APIClient +from trustcafeapiwrapper import APIClient import os, simplejson as json # Handle environment variables @@ -46,9 +46,9 @@ def save_response(response): -# print("-----------Get a user profile----------------") -# profile = API.run_job('userprofile.get', "simon-little") -# print(profile) +print("-----------Get a user profile----------------") +profile = API.run_job('userprofile.get', "simon-little") +print(profile) # print("-------------- Get a branch -----------------") # branch = API.run_job('branch.get', "music") # print(branch) @@ -135,7 +135,7 @@ def save_response(response): # save_response(API.run_job('post.listall')) # save_response(API.run_job('post.listpublic')) -from wrappers.post.create_post import create_post +from trustcafeapiwrapper.wrappers.post.create_post import create_post # save_response(create_post( # post_text="This is a test post created via the create_post wrapper function.", @@ -156,6 +156,6 @@ from wrappers.post.create_post import create_post # ) # save_response(API.run_job(**wrapped)) -# save_response(API.wrapped(create_post( -# "This is a test post created via the create_post wrapper function.", -# ))) \ No newline at end of file +save_response(API.wrapped(create_post( + "This is a test post created via the create_post wrapper function.", +))) \ No newline at end of file diff --git a/trustcafeapiwrapper/__init__.py b/trustcafeapiwrapper/__init__.py new file mode 100644 index 0000000..42e173d --- /dev/null +++ b/trustcafeapiwrapper/__init__.py @@ -0,0 +1 @@ +from .apiclient import APIClient \ No newline at end of file diff --git a/apiclient.py b/trustcafeapiwrapper/apiclient.py similarity index 95% rename from apiclient.py rename to trustcafeapiwrapper/apiclient.py index f2f0dcf..0fe78ef 100644 --- a/apiclient.py +++ b/trustcafeapiwrapper/apiclient.py @@ -1,5 +1,3 @@ -import os -import token import requests import simplejson as json from urllib.parse import urlencode @@ -140,7 +138,7 @@ class APIClient(BaseModel): if isinstance(job_function, str): # Dynamically import the job function from the jobs module module_name, func_name = job_function.rsplit('.', 1) - module = __import__(f"jobs.{module_name}", fromlist=[func_name]) + module = __import__(f"trustcafeapiwrapper.jobs.{module_name}", fromlist=[func_name]) job_func = getattr(module, func_name) else: job_func = job_function diff --git a/jobs/__init__.py b/trustcafeapiwrapper/jobs/__init__.py similarity index 100% rename from jobs/__init__.py rename to trustcafeapiwrapper/jobs/__init__.py diff --git a/jobs/branch/__init__.py b/trustcafeapiwrapper/jobs/branch/__init__.py similarity index 100% rename from jobs/branch/__init__.py rename to trustcafeapiwrapper/jobs/branch/__init__.py diff --git a/jobs/branch/get.py b/trustcafeapiwrapper/jobs/branch/get.py similarity index 100% rename from jobs/branch/get.py rename to trustcafeapiwrapper/jobs/branch/get.py diff --git a/jobs/branch/listbyname.py b/trustcafeapiwrapper/jobs/branch/listbyname.py similarity index 100% rename from jobs/branch/listbyname.py rename to trustcafeapiwrapper/jobs/branch/listbyname.py diff --git a/jobs/comment/__init__.py b/trustcafeapiwrapper/jobs/comment/__init__.py similarity index 100% rename from jobs/comment/__init__.py rename to trustcafeapiwrapper/jobs/comment/__init__.py diff --git a/jobs/comment/create.py b/trustcafeapiwrapper/jobs/comment/create.py similarity index 100% rename from jobs/comment/create.py rename to trustcafeapiwrapper/jobs/comment/create.py diff --git a/jobs/comment/listtbypostid.py b/trustcafeapiwrapper/jobs/comment/listtbypostid.py similarity index 100% rename from jobs/comment/listtbypostid.py rename to trustcafeapiwrapper/jobs/comment/listtbypostid.py diff --git a/jobs/feed/__init__.py b/trustcafeapiwrapper/jobs/feed/__init__.py similarity index 100% rename from jobs/feed/__init__.py rename to trustcafeapiwrapper/jobs/feed/__init__.py diff --git a/jobs/feed/cafefeed.py b/trustcafeapiwrapper/jobs/feed/cafefeed.py similarity index 100% rename from jobs/feed/cafefeed.py rename to trustcafeapiwrapper/jobs/feed/cafefeed.py diff --git a/jobs/feed/following.py b/trustcafeapiwrapper/jobs/feed/following.py similarity index 100% rename from jobs/feed/following.py rename to trustcafeapiwrapper/jobs/feed/following.py diff --git a/jobs/notification/__init__.py b/trustcafeapiwrapper/jobs/notification/__init__.py similarity index 100% rename from jobs/notification/__init__.py rename to trustcafeapiwrapper/jobs/notification/__init__.py diff --git a/jobs/notification/listnotifications.py b/trustcafeapiwrapper/jobs/notification/listnotifications.py similarity index 100% rename from jobs/notification/listnotifications.py rename to trustcafeapiwrapper/jobs/notification/listnotifications.py diff --git a/jobs/post/__init__.py b/trustcafeapiwrapper/jobs/post/__init__.py similarity index 100% rename from jobs/post/__init__.py rename to trustcafeapiwrapper/jobs/post/__init__.py diff --git a/jobs/post/create.py b/trustcafeapiwrapper/jobs/post/create.py similarity index 100% rename from jobs/post/create.py rename to trustcafeapiwrapper/jobs/post/create.py diff --git a/jobs/post/get.py b/trustcafeapiwrapper/jobs/post/get.py similarity index 100% rename from jobs/post/get.py rename to trustcafeapiwrapper/jobs/post/get.py diff --git a/jobs/post/listall.py b/trustcafeapiwrapper/jobs/post/listall.py similarity index 100% rename from jobs/post/listall.py rename to trustcafeapiwrapper/jobs/post/listall.py diff --git a/jobs/post/listallrename.py b/trustcafeapiwrapper/jobs/post/listallrename.py similarity index 100% rename from jobs/post/listallrename.py rename to trustcafeapiwrapper/jobs/post/listallrename.py diff --git a/jobs/post/listbybranch.py b/trustcafeapiwrapper/jobs/post/listbybranch.py similarity index 100% rename from jobs/post/listbybranch.py rename to trustcafeapiwrapper/jobs/post/listbybranch.py diff --git a/jobs/post/listbyuserprofile.py b/trustcafeapiwrapper/jobs/post/listbyuserprofile.py similarity index 100% rename from jobs/post/listbyuserprofile.py rename to trustcafeapiwrapper/jobs/post/listbyuserprofile.py diff --git a/jobs/post/listpublic.py b/trustcafeapiwrapper/jobs/post/listpublic.py similarity index 100% rename from jobs/post/listpublic.py rename to trustcafeapiwrapper/jobs/post/listpublic.py diff --git a/jobs/userprofile/__init__.py b/trustcafeapiwrapper/jobs/userprofile/__init__.py similarity index 100% rename from jobs/userprofile/__init__.py rename to trustcafeapiwrapper/jobs/userprofile/__init__.py diff --git a/jobs/userprofile/get.py b/trustcafeapiwrapper/jobs/userprofile/get.py similarity index 100% rename from jobs/userprofile/get.py rename to trustcafeapiwrapper/jobs/userprofile/get.py diff --git a/tests/utils/get_parent_pksk_from_path.py b/trustcafeapiwrapper/tests/utils/get_parent_pksk_from_path.py similarity index 100% rename from tests/utils/get_parent_pksk_from_path.py rename to trustcafeapiwrapper/tests/utils/get_parent_pksk_from_path.py diff --git a/tests/utils/get_post_pksk.py b/trustcafeapiwrapper/tests/utils/get_post_pksk.py similarity index 100% rename from tests/utils/get_post_pksk.py rename to trustcafeapiwrapper/tests/utils/get_post_pksk.py diff --git a/tests/wrappers/create_comment.py b/trustcafeapiwrapper/tests/wrappers/create_comment.py similarity index 100% rename from tests/wrappers/create_comment.py rename to trustcafeapiwrapper/tests/wrappers/create_comment.py diff --git a/tests/wrappers/create_post.py b/trustcafeapiwrapper/tests/wrappers/create_post.py similarity index 100% rename from tests/wrappers/create_post.py rename to trustcafeapiwrapper/tests/wrappers/create_post.py diff --git a/utils/__init__.py b/trustcafeapiwrapper/utils/__init__.py similarity index 100% rename from utils/__init__.py rename to trustcafeapiwrapper/utils/__init__.py diff --git a/utils/get_parent_pksk_from_path.py b/trustcafeapiwrapper/utils/get_parent_pksk_from_path.py similarity index 100% rename from utils/get_parent_pksk_from_path.py rename to trustcafeapiwrapper/utils/get_parent_pksk_from_path.py diff --git a/utils/get_post_pksk.py b/trustcafeapiwrapper/utils/get_post_pksk.py similarity index 100% rename from utils/get_post_pksk.py rename to trustcafeapiwrapper/utils/get_post_pksk.py diff --git a/wrappers/__init__.py b/trustcafeapiwrapper/wrappers/__init__.py similarity index 100% rename from wrappers/__init__.py rename to trustcafeapiwrapper/wrappers/__init__.py diff --git a/wrappers/comment/__init__.py b/trustcafeapiwrapper/wrappers/comment/__init__.py similarity index 100% rename from wrappers/comment/__init__.py rename to trustcafeapiwrapper/wrappers/comment/__init__.py diff --git a/wrappers/comment/create_comment.py b/trustcafeapiwrapper/wrappers/comment/create_comment.py similarity index 87% rename from wrappers/comment/create_comment.py rename to trustcafeapiwrapper/wrappers/comment/create_comment.py index 2711be7..9664053 100644 --- a/wrappers/comment/create_comment.py +++ b/trustcafeapiwrapper/wrappers/comment/create_comment.py @@ -1,6 +1,6 @@ -from utils.get_parent_pksk_from_path import get_parent_pksk_from_path -from utils.get_post_pksk import get_post_pksk +from trustcafeapiwrapper.utils.get_parent_pksk_from_path import get_parent_pksk_from_path +from trustcafeapiwrapper.utils.get_post_pksk import get_post_pksk def create_comment(comment_text, post_slug, parent_path, blur_label=None, version=3): """ Creates a new comment. diff --git a/wrappers/post/__init__.py b/trustcafeapiwrapper/wrappers/post/__init__.py similarity index 100% rename from wrappers/post/__init__.py rename to trustcafeapiwrapper/wrappers/post/__init__.py diff --git a/wrappers/post/create_post.py b/trustcafeapiwrapper/wrappers/post/create_post.py similarity index 90% rename from wrappers/post/create_post.py rename to trustcafeapiwrapper/wrappers/post/create_post.py index 9884e2f..af25048 100644 --- a/wrappers/post/create_post.py +++ b/trustcafeapiwrapper/wrappers/post/create_post.py @@ -1,4 +1,4 @@ -from utils.get_parent_pksk_from_path import get_parent_pksk_from_path +from trustcafeapiwrapper.utils.get_parent_pksk_from_path import get_parent_pksk_from_path def create_post(post_text, parent_path='/', blur_label=None, card_url=None, collaborative=False): """