Skip to content

Commit

Permalink
实现 更新成员加入条件. close #9
Browse files Browse the repository at this point in the history
  • Loading branch information
mozillazg committed Nov 1, 2013
1 parent ab47568 commit c2d4894
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/shanbay.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,19 @@ def server_date(self):
'%a, %d %b %Y %H:%M:%S GMT')
# 北京时间 = UTC + 8 hours
return date_utc + datetime.timedelta(hours=8)

def update_limit(self, days, kind=2, condition='>='):
"""更新成员加入条件"""
if self.team_id is None:
self.get_team_id()
url = 'http://www.shanbay.com/team/setqualification/%s' % self.team_id
assert days > 0
data = {
'kind': kind,
'condition': condition,
'value': days,
'team': self.team_id
}
data.update(self.base_data_post)
response = requests.post(url, data=data, **self.kwargs)
return response.url == 'http://www.shanbay.com/invite/?kind=team'
5 changes: 5 additions & 0 deletions tests/test_shanbay.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,8 @@ def test_server_date():
"""服务器时间"""
print('')
print shanbay.server_date()


def test_update_limit():
"""更新成员加入条件"""
shanbay.update_limit(10)

0 comments on commit c2d4894

Please sign in to comment.