Wrike Information (Folder, Task, Details) in Python

Here is sample python: would be happy to help.

def WrikeResponse (url, querystring):
wrikeurl = 'https://www.wrike.com/api/v4/' + url
payload = ""
headers = {
'Authorization': "Bearer eyJ0dCI6InAiLCJhbGciOiJIUzI1NiIsInR2IjoiMSJ9.eyJkIjoie1wiYVwiOjc4NjMyNSxcImlcIjo2MTQzMTM4LFwiY1wiOjQ1OTMzMjQsXCJ1XCI6MzI1OTkzOSxcInJcIjpcIlVTXCIsXCJzXCI6W1wiV1wiLFwiRlwiLFwiSVwiLFwiVVwiLFwiS1wiLFwiQ1wiLFwiQVwiLFwiTFwiXSxcInpcIjpbXSxcInRcIjowfSIsImlhdCI6MTU1NjMwMjQyMn0.EoAcG1jk2Mr4ecBwl3fPCfucbHbLme4oT7pyZofT8eI",
'cache-control': "no-cache",
}
jsondata = ''
try:
with requests.request("GET", wrikeurl, data=payload, headers=headers, params=querystring) as response:
if response.status_code == 200:
jsondata = response.json()
else:
jsondata = response.status_code
except:
print('Error while fetching data!')
return jsondata


def GetFolders():
url = 'folders'
records = []
querystring = ""
jsondata = WrikeResponse(url, querystring)
for row in jsondata['data']:
item = row['id'], row['title']
records.append(item)
return records

def GetProjectsFromFolder(FolderId):
url = 'folders/' + FolderId + '/tasks'
records = []
querystring = {
'fields': '["subTaskIds","customFields"]',
'descendants': 'true',
'subTasks': 'true',
}
jsondata = WrikeResponse(url, querystring)
for row in jsondata['data']:
item = {'id': row['id'], 'title': row['title'], 'status': row['status'],
'customStatusId': row['customStatusId'], 'dates': row['dates'], 'subTaskIds': row['subTaskIds'],
'customFields': row['customFields']}
records.append(item)
return records



import Wrike
import tkinter as tk
from pandastable import Table
import pandas as pd

allFolders = Wrike.GetFolders()
folderId = [f for f in allFolders if f[1] == "folder name"]
allProjects = Wrike.GetProjectsFromFolder(folderId[0][0])
filteredProjects = [x for x in allProjects if x['status'] == 'Active']
df = pd.DataFrame(allProjects)
df.to_excel(r'C:\Users\PACE\Desktop\export_dataframe.xlsx', index=False, header=True)

root = tk.Tk()
root.title('PandasTable Example')

frame = tk.Frame(root)
frame.pack(fill='both', expand=True)

pt = Table(frame, dataframe=df, showtoolbar=True, showstatusbar=True)
pt.show()

pt.columncolors['A'] = 'red'
pt.columncolors['B'] = 'green'

root.mainloop()
2
0 Kommentare

Can you help? Answer the question and work your way towards becoming a Wrike Ninja 🥋 Sign in and answer.

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Folllowing List for Post: Wrike Information (Folder, Task, Details) in Python
[this list is visible for admins and agents only]

Didn’t find what you were looking for? Write new post