Skip to content

Commit

Permalink
Fix all remaining SyntaxError and IndentationError
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy1339 committed May 25, 2017
1 parent 0f99d6d commit 0762d57
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tptapi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _post(url, params=None, data=None):
headers["X-Auth-Session-Key"] = self.loginData["SessionKey"]
return requests.post(url, params=params, data=data, headers=headers)

def login(self, user, password){
def login(self, user, password):
hash = md5("{0}-{1}".format(user, md5(password)))
form = {
"Username": user,
Expand All @@ -41,11 +41,11 @@ def login(self, user, password){
self.loginData = r.json()
if len(j["Notifications"]):
six.print_("User has a new notifications: "+", ".join(j["Notifications"]))
del self.loginData["Status"]
del self.loginData["Notifications"]
del self.loginData["Status"]
del self.loginData["Notifications"]
else:
raise errors.InvalidLogin()
return r.status_code == requests.codes.ok
return r.status_code == requests.codes.ok

def checkLogin(self):
r = self._get(self.base_url + "/Login.json").json()
Expand All @@ -55,20 +55,20 @@ def vote(self, id, type):
# type can be -1 or +1
form = {
"ID": Number(id),
"Action": (type>0):"Up":"Down"
"Action": "Up" if type > 0 else "Down"
}
r = self._post(self.base_url + "/Vote.api", data=form)
return r.text() == "OK"

def comment(self, id, content) {
def comment(self, id, content):
form = {
"Comment": content
}
qs = {"ID": id}
r = self._post(self.base_url + "/Vote.api", data=form, params=qs)
return r.status

def addTag(self, id, tag){
def addTag(self, id, tag):
qs = {
"ID": id,
"Tag": tag,
Expand All @@ -84,9 +84,9 @@ def delTag(self, id, tag):
"Tag": tag,
"Op": "delete",
"Key": self.loginData.SessionKey
}
r = self._get(self.base_url + "/Browse/EditTag.json", params=qs)
return r.status
}
r = self._get(self.base_url + "/Browse/EditTag.json", params=qs)
return r.status

def delSave(self, id):
qs = {
Expand Down Expand Up @@ -131,23 +131,23 @@ def browse(self, query, count,start):
r = self._get(self.base_url + "/Browse.json", params=qs)
return r

def listTags(self, c, s){
def listTags(self, c, s):
qs = {
Start: s,
Count: c
}
r = self._get(self.base_url + "/Browse/Tags.json", params=qs)
return rp(o)

def fav(self, id){
def fav(self, id):
qs = {
"ID": id,
"Key": self.loginData.SessionKey
}
r = self._get(self.base_url + "/Browse/Favourite.json", params=qs)
return r.status

def remfav(self, id){
def remfav(self, id):
qs = {
"ID": id,
"Key": self.loginData.SessionKey,
Expand Down Expand Up @@ -177,12 +177,12 @@ def updateSave(self, id, data, desc):
r = self._post(self.base_url + "/Vote.api", data=form)
return r.text() == "OK"

def saveData(self, id) {
def saveData(self, id):
qs = {"ID":id}
r = self._get(self.base_url + "/Browse/View.json", params=qs)
return rp(o)

def startup(self){
def startup(self):
return self._get(self.base_url + "/Startup.json").json()

def comments(self, id, count, start):
Expand Down

0 comments on commit 0762d57

Please sign in to comment.