<?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: Issue with demo webhoook app running at mdwebhook.herokuapp.com in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/260500#M15163</link>
    <description>Can you elaborate on what exactly you mean when you say they are "still not working"? Are you getting the same "Internal Server Error" as before? I re-enabled some functionality that was disabled and causing it to fail before. It's now working properly for me. &lt;BR /&gt;&lt;BR /&gt;In any case, is the updated code working for you? If so, please use that as your reference.</description>
    <pubDate>Mon, 15 Jan 2018 16:57:37 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2018-01-15T16:57:37Z</dc:date>
    <item>
      <title>Issue with demo webhoook app running at mdwebhook.herokuapp.com</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/260053#M15137</link>
      <description>&lt;P&gt;Dear all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to use webhook in one of our projects. I have carefully read webhook documentation available at&amp;nbsp;&lt;A href="https://www.dropbox.com/developers/reference/webhooks" target="_blank"&gt;https://www.dropbox.com/developers/reference/webhooks&lt;/A&gt;. Within th tuturial there is demo webhook deployed at&amp;nbsp;mdwebhook.herokuapp.com but is not working. When I open the app and connect to my dropbox account it migrates to an error page as shown in the below screenshot. I also deployed the same app at heroku myself and receive the same error. Could someone help me to rectify this issue? Thank you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 999px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/2182i536DF7110C65AE4F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindest Regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Farzad&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:16:10 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/260053#M15137</guid>
      <dc:creator>farzad2004</dc:creator>
      <dc:date>2019-05-29T09:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with demo webhoook app running at mdwebhook.herokuapp.com</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/260171#M15143</link>
      <description>Thanks for the report Farzad! It looks like we haven't updated the source code on GitHub or the deployed version for API v2, so it wasn't currently working. I temporarily re-enabled it, so it should be working again. I'll ask the team to update the source and deployed app.&lt;BR /&gt;&lt;BR /&gt;Please use the code from the documentation itself though, which is updated for API v2:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropbox.com/developers/reference/webhooks" target="_blank"&gt;https://www.dropbox.com/developers/reference/webhooks&lt;/A&gt;</description>
      <pubDate>Fri, 12 Jan 2018 16:40:20 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/260171#M15143</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-01-12T16:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with demo webhoook app running at mdwebhook.herokuapp.com</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/260335#M15148</link>
      <description>&lt;P&gt;Thanks dear Greg, I manage to change the github codebase based on the&amp;nbsp;&lt;SPAN&gt;code from the webhook documentation. BTW, I didn't get what you mean by termporarily re-enable it as both the demo webhook app and github are still not working. Thanks.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Kindest Regards, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Farzad&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2018 10:31:59 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/260335#M15148</guid>
      <dc:creator>farzad2004</dc:creator>
      <dc:date>2018-01-14T10:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with demo webhoook app running at mdwebhook.herokuapp.com</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/260500#M15163</link>
      <description>Can you elaborate on what exactly you mean when you say they are "still not working"? Are you getting the same "Internal Server Error" as before? I re-enabled some functionality that was disabled and causing it to fail before. It's now working properly for me. &lt;BR /&gt;&lt;BR /&gt;In any case, is the updated code working for you? If so, please use that as your reference.</description>
      <pubDate>Mon, 15 Jan 2018 16:57:37 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/260500#M15163</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-01-15T16:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with demo webhoook app running at mdwebhook.herokuapp.com</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/260711#M15198</link>
      <description>&lt;P&gt;Hi Greg,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks for your response. I used my business dropbox account and it did not working (i.e., throwing the same internal server error). Today, I checked with my personal account and it worked.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, I am trying to change the&amp;nbsp;mdwebhook github code based on the documentation at&amp;nbsp;&lt;A href="https://www.dropbox.com/developers/reference/webhooks" target="_blank"&gt;https://www.dropbox.com/developers/reference/webhooks&lt;/A&gt; but haven't been succeded as documentation does not include all the code functions (I receive several OAuth error while deploying the code). My changed code is available at&amp;nbsp;&lt;A href="https://github.com/farzad2004/qldwebhook/blob/master/app.py" target="_blank"&gt;https://github.com/farzad2004/qldwebhook/blob/master/app.py&lt;/A&gt;. I am wondering if you could direct me to the right direction about what I am missing while changing the code. Again, thank you.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kindest Regards,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Farzad&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 12:49:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/260711#M15198</guid>
      <dc:creator>farzad2004</dc:creator>
      <dc:date>2018-01-16T12:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with demo webhoook app running at mdwebhook.herokuapp.com</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/260789#M15205</link>
      <description>I'm not sure I understand your latest question. Can you share the steps to reproduce the issue, and the full error/output you're getting? Thanks in advance!</description>
      <pubDate>Tue, 16 Jan 2018 17:34:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/260789#M15205</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-01-16T17:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with demo webhoook app running at mdwebhook.herokuapp.com</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/261128#M15224</link>
      <description>&lt;P&gt;Hi Greg,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks for your response. After hours of working on updating the webhook source code based on API V2.0, I could finally come up with a working code. I put the content of app.py file (as the main file that needed to be updated in below) for the reference of other people who might have the same problem. Again, thank you.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;hashlib &lt;SPAN&gt;import &lt;/SPAN&gt;sha256&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;hmac&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;json&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;os&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;threading&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;urlparse&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;dropbox &lt;SPAN&gt;import &lt;/SPAN&gt;DropboxOAuth2Flow&lt;SPAN&gt;, &lt;/SPAN&gt;oauth&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;flask &lt;SPAN&gt;import &lt;/SPAN&gt;abort&lt;SPAN&gt;, &lt;/SPAN&gt;Flask&lt;SPAN&gt;, &lt;/SPAN&gt;redirect&lt;SPAN&gt;, &lt;/SPAN&gt;render_template&lt;SPAN&gt;, &lt;/SPAN&gt;request&lt;SPAN&gt;, &lt;/SPAN&gt;session&lt;SPAN&gt;, &lt;/SPAN&gt;url_for&lt;BR /&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;markdown &lt;SPAN&gt;import &lt;/SPAN&gt;markdown&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;redis&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;dropbox&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;redis_url = os.environ[&lt;SPAN&gt;'REDISTOGO_URL'&lt;/SPAN&gt;]&lt;BR /&gt;redis_client = redis.from_url(redis_url)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# App key and secret from the App console (dropbox.com/developers/apps)&lt;BR /&gt;&lt;/SPAN&gt;APP_KEY = os.environ[&lt;SPAN&gt;'APP_KEY'&lt;/SPAN&gt;]&lt;BR /&gt;APP_SECRET = os.environ[&lt;SPAN&gt;'APP_SECRET'&lt;/SPAN&gt;]&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;app = Flask(__name__)&lt;BR /&gt;app.debug = &lt;SPAN&gt;True&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# A random secret used by Flask to encrypt session data cookies&lt;BR /&gt;&lt;/SPAN&gt;app.secret_key = os.environ[&lt;SPAN&gt;'FLASK_SECRET_KEY'&lt;/SPAN&gt;]&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;get_url&lt;/SPAN&gt;(route):&lt;BR /&gt;   &lt;SPAN&gt;'''Generate a proper URL, forcing HTTPS if not running locally'''&lt;BR /&gt;&lt;/SPAN&gt;   host = urlparse.urlparse(request.url).hostname&lt;BR /&gt;   url = url_for(&lt;BR /&gt;      route&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;      &lt;SPAN&gt;_external&lt;/SPAN&gt;=&lt;SPAN&gt;True&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;      &lt;SPAN&gt;_scheme&lt;/SPAN&gt;=&lt;SPAN&gt;'http' &lt;/SPAN&gt;&lt;SPAN&gt;if &lt;/SPAN&gt;host &lt;SPAN&gt;in &lt;/SPAN&gt;(&lt;SPAN&gt;'127.0.0.1'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'localhost'&lt;/SPAN&gt;) &lt;SPAN&gt;else &lt;/SPAN&gt;&lt;SPAN&gt;'https'&lt;BR /&gt;&lt;/SPAN&gt;   )&lt;BR /&gt;   &lt;SPAN&gt;print &lt;/SPAN&gt;url&lt;BR /&gt;   &lt;SPAN&gt;return &lt;/SPAN&gt;url&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;get_flow&lt;/SPAN&gt;():&lt;BR /&gt;    &lt;SPAN&gt;return &lt;/SPAN&gt;DropboxOAuth2Flow(&lt;BR /&gt;        APP_KEY&lt;SPAN&gt;, &lt;/SPAN&gt;APP_SECRET&lt;SPAN&gt;, &lt;/SPAN&gt;get_url(&lt;SPAN&gt;'oauth_callback'&lt;/SPAN&gt;)&lt;SPAN&gt;, &lt;/SPAN&gt;session&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;        &lt;SPAN&gt;"dropbox-auth-csrf-token"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@app.route&lt;/SPAN&gt;(&lt;SPAN&gt;'/welcome'&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;welcome&lt;/SPAN&gt;():&lt;BR /&gt;   &lt;SPAN&gt;return &lt;/SPAN&gt;render_template(&lt;SPAN&gt;'welcome.html'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;redirect_url&lt;/SPAN&gt;=get_url(&lt;SPAN&gt;'oauth_callback'&lt;/SPAN&gt;)&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                          &lt;SPAN&gt;webhook_url&lt;/SPAN&gt;=get_url(&lt;SPAN&gt;'webhook'&lt;/SPAN&gt;)&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;home_url&lt;/SPAN&gt;=get_url(&lt;SPAN&gt;'index'&lt;/SPAN&gt;)&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;app_key&lt;/SPAN&gt;=APP_KEY)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# URL handler for /dropbox-auth-finish&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;@app.route&lt;/SPAN&gt;(&lt;SPAN&gt;'/oauth_callback'&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;oauth_callback&lt;/SPAN&gt;():&lt;BR /&gt;&lt;BR /&gt;   oauth_result = get_flow().finish(request.args)&lt;BR /&gt;   &lt;SPAN&gt;print &lt;/SPAN&gt;oauth_result&lt;BR /&gt;&lt;BR /&gt;   redis_client.hset(&lt;SPAN&gt;'tokens'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;oauth_result.account_id&lt;SPAN&gt;,  &lt;/SPAN&gt;oauth_result.access_token)&lt;BR /&gt;&lt;BR /&gt;   process_user(oauth_result.account_id)&lt;BR /&gt;&lt;BR /&gt;   &lt;SPAN&gt;return &lt;/SPAN&gt;redirect(url_for(&lt;SPAN&gt;'done'&lt;/SPAN&gt;))&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;process_user&lt;/SPAN&gt;(account):&lt;BR /&gt;   &lt;SPAN&gt;'''Call /files/list_folder for the given user ID and process any changes.'''&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;   &lt;SPAN&gt;# OAuth token for the user&lt;BR /&gt;&lt;/SPAN&gt;   token = redis_client.hget(&lt;SPAN&gt;'tokens'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;account)&lt;BR /&gt;&lt;BR /&gt;   &lt;SPAN&gt;# cursor for the user (None the first time)&lt;BR /&gt;&lt;/SPAN&gt;   cursor = redis_client.hget(&lt;SPAN&gt;'cursors'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;account)&lt;BR /&gt;&lt;BR /&gt;   dbx = dropbox.Dropbox(token)&lt;BR /&gt;   has_more = &lt;SPAN&gt;True&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;   &lt;SPAN&gt;while &lt;/SPAN&gt;has_more:&lt;BR /&gt;      &lt;SPAN&gt;if &lt;/SPAN&gt;cursor &lt;SPAN&gt;is &lt;/SPAN&gt;&lt;SPAN&gt;None&lt;/SPAN&gt;:&lt;BR /&gt;         result = dbx.files_list_folder(&lt;SPAN&gt;path&lt;/SPAN&gt;=&lt;SPAN&gt;''&lt;/SPAN&gt;)&lt;BR /&gt;      &lt;SPAN&gt;else&lt;/SPAN&gt;:&lt;BR /&gt;         result = dbx.files_list_folder_continue(cursor)&lt;BR /&gt;&lt;BR /&gt;      &lt;SPAN&gt;for &lt;/SPAN&gt;entry &lt;SPAN&gt;in &lt;/SPAN&gt;result.entries:&lt;BR /&gt;&lt;BR /&gt;         &lt;SPAN&gt;# Ignore deleted files, folders, and non-markdown files&lt;BR /&gt;&lt;/SPAN&gt;         &lt;SPAN&gt;if &lt;/SPAN&gt;(&lt;SPAN&gt;isinstance&lt;/SPAN&gt;(entry&lt;SPAN&gt;, &lt;/SPAN&gt;dropbox.files.DeletedMetadata) &lt;SPAN&gt;or&lt;BR /&gt;&lt;/SPAN&gt;                &lt;SPAN&gt;isinstance&lt;/SPAN&gt;(entry&lt;SPAN&gt;, &lt;/SPAN&gt;dropbox.files.FolderMetadata) &lt;SPAN&gt;or&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;                not &lt;/SPAN&gt;entry.path_lower.endswith(&lt;SPAN&gt;'.md'&lt;/SPAN&gt;)):&lt;BR /&gt;            &lt;SPAN&gt;continue&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;         &lt;SPAN&gt;# Convert to Markdown and store as &amp;lt;basename&amp;gt;.html&lt;BR /&gt;&lt;/SPAN&gt;         _&lt;SPAN&gt;, &lt;/SPAN&gt;resp = dbx.files_download(entry.path_lower)&lt;BR /&gt;         html = markdown(resp.content)&lt;BR /&gt;         f = &lt;SPAN&gt;open&lt;/SPAN&gt;(&lt;SPAN&gt;'html1.html'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'w'&lt;/SPAN&gt;)&lt;BR /&gt;         f.write(html.encode(&lt;SPAN&gt;'utf8'&lt;/SPAN&gt;))&lt;BR /&gt;         f.close()&lt;BR /&gt;&lt;BR /&gt;         &lt;SPAN&gt;with &lt;/SPAN&gt;&lt;SPAN&gt;open&lt;/SPAN&gt;(&lt;SPAN&gt;'html1.html'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"rb"&lt;/SPAN&gt;) &lt;SPAN&gt;as &lt;/SPAN&gt;f:&lt;BR /&gt;            dbx.files_upload(f.read()&lt;SPAN&gt;, &lt;/SPAN&gt;entry.path_lower[:-&lt;SPAN&gt;3&lt;/SPAN&gt;] + &lt;SPAN&gt;'.html'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;mode&lt;/SPAN&gt;=dropbox.files.WriteMode(&lt;SPAN&gt;'overwrite'&lt;/SPAN&gt;))&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;      &lt;SPAN&gt;# Update cursor&lt;BR /&gt;&lt;/SPAN&gt;      cursor = result.cursor&lt;BR /&gt;      redis_client.hset(&lt;SPAN&gt;'cursors'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;account&lt;SPAN&gt;, &lt;/SPAN&gt;cursor)&lt;BR /&gt;&lt;BR /&gt;      &lt;SPAN&gt;# Repeat only if there's more to do&lt;BR /&gt;&lt;/SPAN&gt;      has_more = result.has_more&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@app.route&lt;/SPAN&gt;(&lt;SPAN&gt;'/'&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;index&lt;/SPAN&gt;():&lt;BR /&gt;   &lt;SPAN&gt;return &lt;/SPAN&gt;render_template(&lt;SPAN&gt;'index.html'&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# URL handler for /dropbox-auth-start&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;@app.route&lt;/SPAN&gt;(&lt;SPAN&gt;'/login'&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;login&lt;/SPAN&gt;():&lt;BR /&gt;&lt;BR /&gt;   authorize_url = get_flow().start()&lt;BR /&gt;   &lt;SPAN&gt;return &lt;/SPAN&gt;redirect(authorize_url)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@app.route&lt;/SPAN&gt;(&lt;SPAN&gt;'/done'&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;done&lt;/SPAN&gt;():&lt;BR /&gt;   &lt;SPAN&gt;return &lt;/SPAN&gt;render_template(&lt;SPAN&gt;'done.html'&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@app.route&lt;/SPAN&gt;(&lt;SPAN&gt;'/webhook'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;methods&lt;/SPAN&gt;=[&lt;SPAN&gt;'GET'&lt;/SPAN&gt;])&lt;BR /&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;verify&lt;/SPAN&gt;():&lt;BR /&gt;   &lt;SPAN&gt;'''Respond to the webhook verification (GET request) by echoing back the challenge parameter.'''&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;   &lt;SPAN&gt;return &lt;/SPAN&gt;request.args.get(&lt;SPAN&gt;'challenge'&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;validate_request&lt;/SPAN&gt;():&lt;BR /&gt;    &lt;SPAN&gt;'''Validate that the request is properly signed by Dropbox.&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;       (If not, this is a spoofed webhook.)'''&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    signature = request.headers.get(&lt;SPAN&gt;'X-Dropbox-Signature'&lt;/SPAN&gt;)&lt;BR /&gt;    &lt;SPAN&gt;return &lt;/SPAN&gt;signature == hmac.new(APP_SECRET&lt;SPAN&gt;, &lt;/SPAN&gt;request.data&lt;SPAN&gt;, &lt;/SPAN&gt;sha256).hexdigest()&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@app.route&lt;/SPAN&gt;(&lt;SPAN&gt;'/webhook'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;methods&lt;/SPAN&gt;=[&lt;SPAN&gt;'POST'&lt;/SPAN&gt;])&lt;BR /&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;webhook&lt;/SPAN&gt;():&lt;BR /&gt;   &lt;SPAN&gt;'''Receive a list of changed user IDs from Dropbox and process each.'''&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;   &lt;SPAN&gt;# Make sure this is a valid request from Dropbox&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;   # Make sure this is a valid request from Dropbox&lt;BR /&gt;&lt;/SPAN&gt;   &lt;SPAN&gt;if not &lt;/SPAN&gt;validate_request(): abort(&lt;SPAN&gt;403&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;   &lt;SPAN&gt;for &lt;/SPAN&gt;account &lt;SPAN&gt;in &lt;/SPAN&gt;json.loads(request.data)[&lt;SPAN&gt;'list_folder'&lt;/SPAN&gt;][&lt;SPAN&gt;'accounts'&lt;/SPAN&gt;]:&lt;BR /&gt;      &lt;SPAN&gt;# We need to respond quickly to the webhook request, so we do the&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;      # actual work in a separate thread. For more robustness, it's a&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;      # good idea to add the work to a reliable queue and process the queue&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;      # in a worker process.&lt;BR /&gt;&lt;/SPAN&gt;      threading.Thread(&lt;SPAN&gt;target&lt;/SPAN&gt;=process_user&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;args&lt;/SPAN&gt;=(account&lt;SPAN&gt;,&lt;/SPAN&gt;)).start()&lt;BR /&gt;   &lt;SPAN&gt;return &lt;/SPAN&gt;&lt;SPAN&gt;''&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;if &lt;/SPAN&gt;__name__ == &lt;SPAN&gt;'__main__'&lt;/SPAN&gt;:&lt;BR /&gt;   app.run(&lt;SPAN&gt;debug&lt;/SPAN&gt;=&lt;SPAN&gt;True&lt;/SPAN&gt;)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2018 11:21:47 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-with-demo-webhoook-app-running-at-mdwebhook-herokuapp-com/m-p/261128#M15224</guid>
      <dc:creator>farzad2004</dc:creator>
      <dc:date>2018-01-18T11:21:47Z</dc:date>
    </item>
  </channel>
</rss>

