Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@ ENV/

# Rope project settings
.ropeproject

#giteye
.project
43 changes: 39 additions & 4 deletions periapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,39 @@ def get_user_broadcast_history(self, user_id):
{"user_id": user_id}
)

def get_following(self, user_id):
"""Get a list of following users"""
try:
response = self._post(
'https://api.periscope.tv/api/v2/following',
{"user_id": user_id}
)
except IOError as er:
response = []
return response

def get_followers(self, user_id):
"""Get a list of followers"""
try:
response = self._post(
'https://api.periscope.tv/api/v2/followers',
{"user_id": user_id}
)
except IOError as er:
response = []
return response

def get_user(self, user_id):
"""Users have broadcasts, this lists them"""
try:
response = self._post(
'https://api.periscope.tv/api/v2/user',
{"user_id": user_id}
)
except IOError as er:
response = str(er)
return response

@property
def notifications(self):
"""Current notifications"""
Expand All @@ -96,10 +129,12 @@ def notifications(self):
@property
def following(self):
"""Current people you're following"""
return self._post(
'https://api.periscope.tv/api/v2/following',
{"user_id": self.pubid}
)
return self.get_following(self.pubid)

@property
def followers(self):
"""Current you're followers"""
return self.get_followers(self.pubid)

def get_access(self, broadcast_id):
"""Gets broadcast info (like rtmps url) for private broadcasts"""
Expand Down
2 changes: 1 addition & 1 deletion periapi/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import oauth2 as oauth
import requests

from path import path
from path import Path as path
from .logging import logging

RTOKEN_URL = 'https://api.twitter.com/oauth/request_token?oauth_callback=oob'
Expand Down