<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Trouble migrating from API v1 to v2 in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-migrating-from-API-v1-to-v2/m-p/252681#M14576</link>
    <description>&lt;P&gt;Sorry for the late reply!&lt;/P&gt;&lt;P&gt;I host it on heroku, and it doesn't show error or crash.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Nov 2017 02:18:11 GMT</pubDate>
    <dc:creator>hiweiwei</dc:creator>
    <dc:date>2017-11-15T02:18:11Z</dc:date>
    <item>
      <title>Trouble migrating from API v1 to v2</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-migrating-from-API-v1-to-v2/m-p/251310#M14454</link>
      <description>&lt;P class="p1"&gt;Hello! I have this little code that can search dropbox file from slack,&lt;/P&gt;&lt;P class="p1"&gt;I have been trying to migrate to API V2, but can't get it work.&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;Don't know what the problem is.&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;# encoding: utf-8
import time
import os
import json
from flask import Flask, request, render_template, url_for, json, jsonify
import csv
import dropbox
import requests
import sys
from slackclient import SlackClient
 
reload(sys)
sys.setdefaultencoding('utf-8')
 
app = Flask(__name__)
 
SLACK_WEBHOOK_SECRET = os.environ.get('SLACK_WEBHOOK_SECRET')
 
@app.route('/', methods=['POST'])
def index():
    if request.method == 'POST' and request.form.get('token') == SLACK_WEBHOOK_SECRET:
        username = request.form.get('user_name', 'null')
        text = request.form.get('text', 'null')
        channel = request.form.get('channel_name', 'null')
        
        print channel
        print username
        print text
        
        dbx = dropbox.Dropbox('dropboxtoken')
        metadata, f = dbx.files_download('/inventory.csv')
        out = open('inventory.csv', 'w')
        out.write(f.content)
        out.close()
        
 
        with open('inventory.csv', 'rU') as csvfile:
            readCSV = csv.reader(csvfile, delimiter=',')
 
            
            for i, row in enumerate(readCSV):
                for j, column in enumerate(row):
                    if text.replace("item:", "") in column:
                        print ' '.join(row)
                
                        payload = {"channel": "#"+channel, "username": "ROBOT-1", "text": "您查詢的是::point_down:\n"+' '.join(row), "icon_emoji": ":robot_face:"}
                        r = requests.post('webhookURL', data=json.dumps(payload))
                        print (r.url)
 
 
if __name__ == '__main__':
    app.run(host='0.0.0.0')&lt;/PRE&gt;&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p4"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:17:37 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-migrating-from-API-v1-to-v2/m-p/251310#M14454</guid>
      <dc:creator>hiweiwei</dc:creator>
      <dc:date>2019-05-29T09:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble migrating from API v1 to v2</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-migrating-from-API-v1-to-v2/m-p/251364#M14463</link>
      <description>Can you share the error/output? Thanks in advance!</description>
      <pubDate>Mon, 06 Nov 2017 16:02:14 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-migrating-from-API-v1-to-v2/m-p/251364#M14463</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-11-06T16:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble migrating from API v1 to v2</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-migrating-from-API-v1-to-v2/m-p/252681#M14576</link>
      <description>&lt;P&gt;Sorry for the late reply!&lt;/P&gt;&lt;P&gt;I host it on heroku, and it doesn't show error or crash.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 02:18:11 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-migrating-from-API-v1-to-v2/m-p/252681#M14576</guid>
      <dc:creator>hiweiwei</dc:creator>
      <dc:date>2017-11-15T02:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble migrating from API v1 to v2</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-migrating-from-API-v1-to-v2/m-p/252765#M14590</link>
      <description>Being able to see the exception will be very important in writing/debugging the application, so I highly recommend referring to the Heroku documentation for information on how to retrieve the exception.&lt;BR /&gt;&lt;BR /&gt;If you can't though, try reproducing the issue by running the app locally/in your development environment instead.</description>
      <pubDate>Wed, 15 Nov 2017 15:30:56 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-migrating-from-API-v1-to-v2/m-p/252765#M14590</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-11-15T15:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble migrating from API v1 to v2</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-migrating-from-API-v1-to-v2/m-p/252921#M14598</link>
      <description>Ok! Thank you! I will try it.</description>
      <pubDate>Thu, 16 Nov 2017 05:25:12 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-migrating-from-API-v1-to-v2/m-p/252921#M14598</guid>
      <dc:creator>hiweiwei</dc:creator>
      <dc:date>2017-11-16T05:25:12Z</dc:date>
    </item>
  </channel>
</rss>

