second commit

This commit is contained in:
2022-05-04 08:46:35 -05:00
parent 2e9ec4e70a
commit b6e28aa16a
9 changed files with 35 additions and 38 deletions

View File

24
setup.py Normal file
View 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=[
]
)

View File

@@ -4,7 +4,6 @@ from apiclient import APIClient, HeaderAuthentication, JsonResponseHandler
from collection_json import Collection
import json
class ApiObject():
rel = None

View File

@@ -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)

View File

@@ -1,2 +0,0 @@
token="u2SqDq78FumVvhkt1D-V1CQ2ZIaB-nUVlzGwd1YhGtA"
team_id = 7644001

View File

@@ -1,21 +1,18 @@
import unittest
from credentials import team_id as TEAM_ID
from credentials import token as TOKEN
from teamsnap import TeamSnap
from teamsnap.models import Item
from teamsnap.api import Team, Event, Availability, Me, ApiObject
import teamsnap
TEAM_ID = 7644001
EVENT_1 = 239261604
from os import getenv
c = TeamSnap(token=TOKEN)
es = Event.search(c, team_id=TEAM_ID)
q1 = c.query("events", "search", team_id=TEAM_ID)
team = c.teams.get(TEAM_ID)
event = Item(client=c, rel="events", id=EVENT_1)
# event = c.events.get(239261604)
col = c.get_collection(rel="events", id=EVENT_1)
print(event.data)
TEAMSNAP_TOKEN = getenv('TEAMSNAP_TOKEN')
TEAMSNAP_TEAM = getenv('TEAMSNAP_TEAM')
TEAMSNAP_EVENT = getenv('TEAMSNAP_EVENT')
c = TeamSnap(token=TEAMSNAP_TOKEN)
es = Event.search(c, team_id=TEAMSNAP_TEAM)
q1 = c.query("events", "search", team_id=TEAMSNAP_TEAM)
team = c.teams.get(TEAMSNAP_TEAM)
event = c.events.get(TEAMSNAP_EVENT)
col = c.get_collection(rel="events", id=TEAMSNAP_TEAM)
pass
# q2 = c.events.search(team_id=TEAM_ID)
# a = c.availabilities.search(event_id=q2[0]['id'])