def getStep(gid="0", offset="0", step='10'): '''Служит для получения промежуточного списка документов. Запрашивает \'step\' штук.''' if gid[0]!='-': gid='-'+gid result=[] response= api.call("photos.getAll", {'owner_id': gid, 'count':step, 'offset':offset})[1:] for x in response: result.append([ x[u'text'], x[u'owner_id'], x[u'pid'] ]) return result
def get_address_record(api, contract, address): res = api.call(contract, funid=4, data=[address]) received_by_address, last_updated, nr_watched, last_watched = res return { 'received_by_address': received_by_address, 'last_updated': last_updated, 'nr_watched': nr_watched, 'last_watched': last_watched}
def poll_submit_vote(self, pollId, pollQuestionId, pollQuestionOptionId, otherText, auth=True): params = { "PollID": pollId, "PollQuestionID": pollQuestionId, "PollQuestionOptionID": pollQuestionOptionId, "OtherText": otherText, } return api.call("Poll_SubmitVote_JSON", params, auth, "post")
def call_api(method, **kwargs): post_data = request.form try: j = request.get_json() if j: post_data = j except exceptions.BadRequest: pass result, code = api.call(method, request.args, post_data, kwargs, request.method) return json.dumps(result, ensure_ascii=False, cls=JSONSerializer), code
def checkcrime(lat, lon, radius): return api.call(lat, lon, radius)
def validate(self): params = {'APIKey': api.apiKey, 'Token': api.authToken} return api.call('Validate', params)
def lib_ereserves(self, courseId, titleOnly=False, auth=True): params = {'CourseID': courseId, 'TitleOnly': titleOnly} return api.call('LibEreserves', params, auth)
def code_table_week_types(self, auth=True): return api.call('CodeTable_WeekTypes', {}, auth)
def my_organizer_acad_semester_info(self, acadYear, semester, auth=True): params = {'AcadYear': acadYear, 'Semester': semester} return api.call('MyOrganizer_AcadSemesterInfo', params, auth)
def my_organizer_delete_personal_event(self, eventId, deleteAllRecurrence, auth=True): params = {'EventID': eventId, 'DeleteAllRecurrence': deleteAllRecurrence} return api.call('MyOrganizer_DeletePersonalEvent_JSON', params, auth, 'post')
def my_organizer_add_personal_event(self, eventTitle, venue, eventDateTime, description, recurType, weeklyRecurEvery, strDays, recurTillDate, auth=True): params = {'EventTitle': eventTitle, 'Venue': venue, 'EventDateTime': eventDateTime, 'Description': description, 'RecurType': recurType, 'WeeklyRecurEvery': weeklyRecurEvery, 'StrDays': strDays, 'RecurTillDate': recurTillDate} return api.call('MyOrganizer_AddPersonalEvent_JSON', params, auth, 'post')
def open_webcast_add_log(self, mediaChannelId, mediaChannelItemId, auth=True): params = {'MediaChannelID': mediaChannelId, 'MediaChannelItemID': mediaChannelItemId} return api.call('OpenWebcast_AddLog_JSON', params, auth, 'post')
def call(self, method, auth=True, verb='get', **kwargs): return api.call(method, kwargs, auth, verb)
def polls(self, courseId, pollId, titleOnly=False, auth=True): params = {"CourseID": courseId, "PollID": pollId, "TitleOnly": titleOnly} return api.call("Polls", params, auth)
def poll_get_voted_user_other(self, pollId, pollQuestionId, auth=True): params = {"PollID": pollId, "PollQuestionID": pollQuestionId} return api.call("Poll_GetVotedUser_Other", params, auth)
def __getRankedStatsByPuuid(self, puuid): stats = call(f"{BASE_URL}/lol-ranked/v1/ranked-stats/{puuid}") self.RANKED_SOLO_5x5 = stats["queueMap"]["RANKED_SOLO_5x5"] self.RANKED_FLEX_SR = stats["queueMap"]["RANKED_FLEX_SR"] # stat = rankedStats("9a9d9da3-391d-5b48-a869-3e94f614c957") # PainterHalver
def __populateData(self, url): data = call(url) self.name = data["displayName"] self.accountId = data["accountId"] self.puuid = data["puuid"] self.summonerId = data["summonerId"]
def my_organizer_events(self, startDate=None, endDate=None, auth=True): params = {'StartDate': startDate, 'EndDate': endDate} return api.call('MyOrganizer_Events', params, auth)
def getAmount(gid): '''Возвращает количество фотографий в группе в целом или в альбоме.''' if gid[0]=='-': gid=gid[1:] return int(api.call("photos.getAll", {'owner_id':'-'+gid, 'count': '1'})[0])
def my_organizer_update_personal_event(self, eventId, eventTitle, venue, eventDateTime, description, recurType, weeklyRecurEvery, strDays, recurFromDate, recurTillDate, updateRecurrenceEvent, auth=True): params = {'EventID': eventId, 'EventTitle': eventTitle, 'Venue': venue, 'EventDateTime': eventDateTime, 'Description': description, 'RecurType': recurType, 'WeeklyRecurEvery': weeklyRecurEvery, 'StrDays': strDays, 'RecurFromDate': recurFromDate, 'RecurTillDate': recurTillDate, 'UpdateRecurrenceEvent': updateRecurrenceEvent} return api.call('MyOrganizer_UpdatePersonalEvent_JSON', params, auth, 'post')
def student_events_category(self, categoryId, titleOnly=False, auth=True): params = {'CategoryID': categoryId, 'TitleOnly': titleOnly} return api.call('StudentEvents_Category', params, auth)
def my_organizer_special_days(self, startDate=None, endDate=None, auth=True): params = {'StartDate': startDate, 'EndDate': endDate} return api.call('MyOrganizer_SpecialDays', params, auth)
def student_events_committee(self, committeeId, titleOnly=False, auth=True): params = {'CommitteeID': committeeId, 'TitleOnly': titleOnly} return api.call('StudentEvents_Committee', params, auth)
def my_organizer_personal(self, startDate=None, endDate=None, auth=True): params = {'StartDate': startDate, 'EndDate': endDate} return api.call('MyOrganizer_Personal', params, auth)
def student_events_post_new_event(self, categoryId, committeeId, title, evtStartDate, evtEndDate, auth=True): params = {'CategoryID': categoryId, 'CommitteeID': committeeId, 'Title': title, 'evtStartDate': evtStartDate, 'evtEndDate': evtEndDate} return api.call('StudentEvents_PostNewEvent_JSON', params, auth, 'post')
def my_organizer_ivle(self, startDate=None, endDate=None, auth=True): params = {'StartDate': startDate, 'EndDate': endDate} return api.call('MyOrganizer_IVLE', params, auth)
def student_events(self, titleOnly=False, auth=True): params = {'TitleOnly': titleOnly} return api.call('StudentEvents', params, auth)
def lib_ereserves_files(self, folderId, auth=True): params = {'FolderID': folderId} return api.call('LibEreserveFiles', params, auth)
def student_events_categories(self, includeEvents=True, titleOnly=False, auth=True): params = {'IncludeEvents': includeEvents, 'TitleOnly': titleOnly} return api.call('StudentEvents_Categories', params, auth)
def useremail_get(self): params = {'APIKey': api.apiKey, 'Token': api.authToken} return api.call('UserEmail_Get', params)
def workbins(self, courseId, duration=0, workbinId=None, titleOnly=False, auth=True): params = {'CourseID': courseId, 'Duration': duration, 'WorkbinID': workbinId, 'TitleOnly': titleOnly} return api.call('Workbins', params, auth)
def username_get(self): params = {'APIKey': api.apiKey, 'Token': api.authToken} return api.call('UserName_Get', params)
def open_webcasts(self, acadYear, semester, titleOnly=False, mediaChannelId=None, auth=True): params = {'AcadYear': acadYear, 'Semester': semester, 'TitleOnly': titleOnly, 'MediaChannelID': mediaChannelId} return api.call('OpenWebcasts', params, auth)