{"id":10578,"date":"2019-02-22T09:57:12","date_gmt":"2019-02-22T14:57:12","guid":{"rendered":"https:\/\/qxf2.com\/blog\/?p=10578"},"modified":"2019-02-22T09:57:12","modified_gmt":"2019-02-22T14:57:12","slug":"create-new-trello-boards-python","status":"publish","type":"post","link":"https:\/\/qxf2.com\/blog\/create-new-trello-boards-python\/","title":{"rendered":"Automate creating new boards on Trello using Python"},"content":{"rendered":"<p>This post contains a brief summary of my Qxf2 Hackathon project. It also has a link to a GitHub repository with some useful code that you can use to interact with Trello.<\/p>\n<hr>\n<p>We, at Qxf2, are agile &#038; our sprints last a week. At the end of every week, someone (we rotate the responsibility) creates a new Trello board, add default cards (like one for retrospectives) &#038; then at the start of the sprint people still continuing their work from the last sprint move their card to the new board.<\/p>\n<p>Like every manual re-occurring  chain activity, when the person responsible for creating the Trello board doesn&#8217;t create one, the moving cards to the new sprint activity will be blocked &#038; at times despite the new Trello board available, people working on last week&#8217;s cards required reminder on the team&#8217;s communication channel to move the ticket to the new Board.<\/p>\n<p>This made me realize that automating the creating new Trello boards will:<\/p>\n<ol>\n1. Rollover the sprint accurately<br \/>\n2. Streamline this whole activity<br \/>\n3. Provides a platform for automating other activities, like moving incomplete tasks to the new sprint<\/ol>\n<hr>\n<h3>How I implemented my project:<\/h3>\n<p>Trello exposes API to perform every action that can be performed from the UI. It has a well documented <a href=\"https:\/\/developers.trello.com\/reference\/\">API reference<\/a> section that has examples on how to make API request to perform actions using a few programming languages.<\/p>\n<p>So, I can replace the following manual action<\/p>\n<pre>\r\n<ol>\r\n1. Log in to Trello\r\n2. Click on Create Board\r\n3. Name the Board<\/ol>\r\n<\/pre>\n<p>with a simple API call using Python request module:<\/p>\n<pre lang='python'>\r\nimport requests\r\nresponse=requests.post('https:\/\/api.trello.com\/boards',params=auth_dict_cont_key_token,data=data_dict_cont_name)\r\n<\/pre>\n<p>Very straight-forward, right!!<br \/>\n<strong>Now, to the detailed implementation<\/strong> &#8211; I created a Trello.py class that housed methods to  get the details of the user &#8211; the organization associated with the user, boards the user was added to &#038; add them to the data directory as pickled card &#038; board objects.<br \/>\nThe idea behind having data directory with pickled objects of information of the user was to use them for generating charts, which is yet to be implemented.<br \/>\nI use a runner script to create an instance of the class &#038; execute the class methods. The runner script communicates to a conf file. The conf file holds the key\/token or any other input the runner script.<br \/>\nYou can find the code on GitHub here &#8211; <a href=\"https:\/\/github.com\/shivahari\/trello-sprint-roll-over\">trello-sprint-roll-over<\/a><\/p>\n<hr>\n<h3>Next steps:<\/h3>\n<p>This project is still a work in progress &#038; has been pivoted twice since the start. So what this project does or how it does it may change in the future.<br \/>\nAs a quick next action, I am planning to remove certain functions &#038; use this solely to roll over sprints &#038; later add functions like moving cards from an old sprint to a new one.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post contains a brief summary of my Qxf2 Hackathon project. It also has a link to a GitHub repository with some useful code that you can use to interact with Trello. We, at Qxf2, are agile &#038; our sprints last a week. At the end of every week, someone (we rotate the responsibility) creates a new Trello board, add [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38,188],"tags":[],"class_list":["post-10578","post","type-post","status-publish","format-standard","hentry","category-automation","category-trello"],"_links":{"self":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/10578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/comments?post=10578"}],"version-history":[{"count":20,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/10578\/revisions"}],"predecessor-version":[{"id":10864,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/10578\/revisions\/10864"}],"wp:attachment":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/media?parent=10578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/categories?post=10578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/tags?post=10578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}