7.0 KiB
Table of Contents
About The Project
An unoffical python wrapper for the TeamSnap API. A work in progress.
Built With
Getting Started
Prerequisites
- api-client
pip install api-client - collection-json
pip install json-collection
Installation
- Get OAuth 2 Credentials from TeamSnap at https://auth.teamsnap.com/ (TeamSnap Documentation)
- Install pyteamsnap
pip install git+https://github.com/anthonyscorrea/pyteamsnap
Usage Example
from pyteamsnap.api import TeamSnap, Me, Event, EventLineupEntry, Member
client = TeamSnap(token=TOKEN)
# get authenticated user
me = Me(client)
# get a list of team_ids for the user
managed_team_ids = me.data['managed_teams']
# get a list of events for managed team
managed_team_id = me.data['managed_teams'][0]
events = Event.search(client, team_id=managed_team_id)
# get an object with the object id of EVENT_ID
event = Event.get(client, id=EVENT_ID)
# get some information about the event
start_date = event.data['start_date']
# create a new member
member = Member.new(client)
member.data['first_name'] = 'Ferguson'
member.post()
# update a Member with id of MEMBER_ID
member = Member.get(client, id=MEMBER_ID)
member.data['last_name'] = 'Jenkins'
member.put()
# delete a Member
member.delete()
# perform a bulk load
list_of_ts_objects = client.bulk_load(team_id = TEAM_ID, types = [Event, Member], event__id=EVENT_ID)
Roadmap
Implemented objects
- Me
- User
- Event
- Team
- Availability
- Member
- Location
- Opponent
- EventLineupEntry
- EventLineup
- AvailabilitySummary
Implemented Queries
- search
- bulk_load
Implemented Actions
- create
- read
- update
- destroy
Implemented objects, but not tested.
- Statistics
- MemberStatistics
See the open issues for a full list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE.txt for more information.
Contact
Your Name - @anthonyscorrea - a@correa.co
Project Link: https://github.com/anthonyscorrea/pyteamsnap