0

I've been using Twython (https://github.com/ryanmcgrath/twython) to tweet photos, description and a link. So on Twitter it is displayed as "...description... ...link... ...pic.twitter.com/XXX..."

The problem i have encountered is that these Twitter API requests used for the photo uploads quite often fail with: (403) "Forbidden: The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits. -- Error creating status."

A few notes:

  • https://upload.twitter.com is used for uploads, some sources indicate that using api.twitter.com or just HTTP (no SSL) might cause problems
  • Daily photo upload limit of 30 has NOT been reached by Twitter accounts that experience the problem
  • The tweet does NOT exceed 140 characters (I tried with just 2 word description of the photo and it still failed)

Does anyone have an idea what's wrong?

Thanks a lot.

1 Answers1

0

I hit the same problem and as it turned out, the solution is to send status message encoded into UTF-8. I added debug print statement and my status output looked like this:

\u042d\u0442\u043e\u0442 \u0441\u0442\u0430\u0442\u0443\u0441 \u0431\u044b\u043b \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u043e\u043c \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b

To convert it into UTF-8 it was necessary to do:

status.decode('unicode-escape').encode('utf-8')

> Этот статус был получен парсингом веб-страницы
Max Arnold
  • 427
  • 1
  • 5
  • 11