second commit
This commit is contained in:
24
setup.py
Normal file
24
setup.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
VERSION = '0.0.1'
|
||||||
|
DESCRIPTION = 'Python package to interface with TeamSnap API'
|
||||||
|
LONG_DESCRIPTION = 'https://www.teamsnap.com/documentation'
|
||||||
|
|
||||||
|
# Setting up
|
||||||
|
setup(
|
||||||
|
name="teamsnap-python",
|
||||||
|
version=VERSION,
|
||||||
|
author="Anthony Correa",
|
||||||
|
author_email="a@correa.co",
|
||||||
|
description=DESCRIPTION,
|
||||||
|
long_description=LONG_DESCRIPTION,
|
||||||
|
packages=find_packages(),
|
||||||
|
install_requires=[
|
||||||
|
"api-client",
|
||||||
|
"collection_json"
|
||||||
|
],
|
||||||
|
|
||||||
|
keywords=['teamsnap'],
|
||||||
|
classifiers=[
|
||||||
|
]
|
||||||
|
)
|
||||||
@@ -4,7 +4,6 @@ from apiclient import APIClient, HeaderAuthentication, JsonResponseHandler
|
|||||||
from collection_json import Collection
|
from collection_json import Collection
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
class ApiObject():
|
class ApiObject():
|
||||||
rel = None
|
rel = None
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
from dataclasses import dataclass
|
|
||||||
from typing import Optional
|
|
||||||
from teamsnap.api import TeamSnap
|
|
||||||
from urllib.parse import urljoin
|
|
||||||
|
|
||||||
class Item:
|
|
||||||
id: int
|
|
||||||
type: str
|
|
||||||
data: dict = {}
|
|
||||||
|
|
||||||
def __init__(self, client:TeamSnap, rel, id, data: dict = {}):
|
|
||||||
self._client = client
|
|
||||||
self.type = rel
|
|
||||||
self.id = id
|
|
||||||
self._data = data
|
|
||||||
|
|
||||||
@property
|
|
||||||
def data(self):
|
|
||||||
if self._data: return self._data
|
|
||||||
else:
|
|
||||||
return self._client.get_item(self.type, self.id)
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
token="u2SqDq78FumVvhkt1D-V1CQ2ZIaB-nUVlzGwd1YhGtA"
|
|
||||||
team_id = 7644001
|
|
||||||
@@ -1,21 +1,18 @@
|
|||||||
import unittest
|
import unittest
|
||||||
from credentials import team_id as TEAM_ID
|
|
||||||
from credentials import token as TOKEN
|
|
||||||
from teamsnap import TeamSnap
|
from teamsnap import TeamSnap
|
||||||
from teamsnap.models import Item
|
|
||||||
from teamsnap.api import Team, Event, Availability, Me, ApiObject
|
from teamsnap.api import Team, Event, Availability, Me, ApiObject
|
||||||
import teamsnap
|
from os import getenv
|
||||||
TEAM_ID = 7644001
|
|
||||||
EVENT_1 = 239261604
|
|
||||||
|
|
||||||
c = TeamSnap(token=TOKEN)
|
TEAMSNAP_TOKEN = getenv('TEAMSNAP_TOKEN')
|
||||||
es = Event.search(c, team_id=TEAM_ID)
|
TEAMSNAP_TEAM = getenv('TEAMSNAP_TEAM')
|
||||||
q1 = c.query("events", "search", team_id=TEAM_ID)
|
TEAMSNAP_EVENT = getenv('TEAMSNAP_EVENT')
|
||||||
team = c.teams.get(TEAM_ID)
|
|
||||||
event = Item(client=c, rel="events", id=EVENT_1)
|
c = TeamSnap(token=TEAMSNAP_TOKEN)
|
||||||
# event = c.events.get(239261604)
|
es = Event.search(c, team_id=TEAMSNAP_TEAM)
|
||||||
col = c.get_collection(rel="events", id=EVENT_1)
|
q1 = c.query("events", "search", team_id=TEAMSNAP_TEAM)
|
||||||
print(event.data)
|
team = c.teams.get(TEAMSNAP_TEAM)
|
||||||
|
event = c.events.get(TEAMSNAP_EVENT)
|
||||||
|
col = c.get_collection(rel="events", id=TEAMSNAP_TEAM)
|
||||||
pass
|
pass
|
||||||
# q2 = c.events.search(team_id=TEAM_ID)
|
# q2 = c.events.search(team_id=TEAM_ID)
|
||||||
# a = c.availabilities.search(event_id=q2[0]['id'])
|
# a = c.availabilities.search(event_id=q2[0]['id'])
|
||||||
|
|||||||
Reference in New Issue
Block a user