Skip to content

Commit

Permalink
Make the first alpha release
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy1339 committed May 25, 2017
1 parent ddd1e63 commit 0b4f6fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
exit(-1)

setup(name='zirc',
version='0.0.1',
version='0.1.0',
description='A Python client to interact with powdertoy.co.uk',
long_description=long_description,
url='https://github.com/wolfy1339/tptapi',
Expand All @@ -21,7 +21,7 @@
include_package_data=True,
zip_safe=False,
classifiers=[
'Development Status :: 1 - Planning',
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
Expand Down
24 changes: 12 additions & 12 deletions tptapi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def comment(self, ID, content):
}
qs = {"ID": ID}
r = self._post(self.base_url + "/Browse/Comments.json", data=form, params=qs)
return r.status
return r.status_code == requests.codes.ok

def addTag(self, ID, tag):
qs = {
Expand All @@ -75,7 +75,7 @@ def addTag(self, ID, tag):
"Key": self.loginData.SessionKey
}
r = self._get(self.base_url + "/Browse/EditTag.json", params=qs)
return r.status
return r.status_code == requests.codes.ok

def delTag(self, ID, tag):
qs = {
Expand All @@ -94,7 +94,7 @@ def delSave(self, ID):
"Key": self.loginData.SessionKey
}
r = self._get(self.base_url + "/Browse/Delete.json", params=qs)
return r.status
return r.status_code == requests.codes.ok

def unpublishSave(self, ID):
qs = {
Expand All @@ -103,7 +103,7 @@ def unpublishSave(self, ID):
"Key": self.loginData.SessionKey
}
r = self._get(self.base_url + "/Browse/Delete.json", params=qs)
return r.status
return r.status_code == requests.codes.ok

def publishSave(self, ID, content):
form = {
Expand All @@ -128,23 +128,23 @@ def browse(self, query, count,start):
Search_Query: query
}
r = self._get(self.base_url + "/Browse.json", params=qs)
return r
return r.json()

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

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
return r.status_code == requests.codes.ok

def remfav(self, ID):
qs = {
Expand All @@ -153,7 +153,7 @@ def remfav(self, ID):
"Mode": "Remove"
}
r = self._get(self.base_url + "/Browse/Tags.json", params=qs)
return r.status
return r.status_code == requests.codes.ok

def save(self, name, desc, data):
# action can be -1 or +1
Expand All @@ -169,17 +169,17 @@ def save(self, name, desc, data):
def updateSave(self, ID, data, desc):
# action can be -1 or +1
form = {
"ID": Number(ID),
"ID": int(ID),
"Description": desc,
"Data": data
}
r = self._post(self.base_url + "/Vote.api", data=form)
return r.text() == "OK"

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

def startup(self):
return self._get(self.base_url + "/Startup.json").json()
Expand All @@ -191,4 +191,4 @@ def comments(self, ID, count, start):
"ID": ID
}
r = self._get(self.base_url + "/Browse/Comments.json", params=qs)
return rp(o)
return r.json()

0 comments on commit 0b4f6fb

Please sign in to comment.