Ask Your Question

The 'API' does not work on our site - it results in errors. How can this be fixed?

asked 2014-12-08 00:45:04 -0600

tim's avatar

updated 2014-12-13 17:29:36 -0600

Evgeny's avatar

I tried to use the 'API' as described by this page:

Unfortunately the only 'API' url that works is: /api/v1/info/

The others result in emails being sent with content similar to the following:

ERROR (EXTERNAL IP): Internal Server Error: /api/v1/questions/

Traceback (most recent call last):

  File "C:\Python27\lib\site-packages\django\core\handlers\", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File ".\askbot\views\", line 190, in questions
    datum = get_question_data(thread)

  File ".\askbot\views\", line 31, in get_question_data
    'added_at': thread.added_at.strftime('%s'),

ValueError: Invalid format string

Is this a known bug and how can we fix it? I am assuming this is something in the py file that is failing based on the error message

When I comment out the line that has the strftime and then retry the 'API' url, I get another error:

Server Error

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

It does not appear to me that this ever worked. How can this be fixed?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-12-13 17:28:55 -0600

Evgeny's avatar

This bug is fixed in the repository, thank you for reporting. An update release will be made soon.

edit flag offensive delete link more


Great, thanks Evgeny!

tim's avatar tim  ( 2014-12-13 19:02:45 -0600 )edit

answered 2014-12-08 13:11:43 -0600

tim's avatar

I commented out the lines that contained strftime() calls (4 of them) and the 'API' urls work, but now there are no date/time fields that are populated for those pieces of data.

We still have issues with incorrect information being displayed, but at least now the pages display

edit flag offensive delete link more



`datetime.strftime('%s')` works on some systems, but's a side-effect of a specific implementation, not intended by the library designers. I've added function `askbot.utils.functions.get_epoch_str` which formats the datetime objects as required here.

Evgeny's avatar Evgeny  ( 2014-12-13 17:31:56 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-12-08 00:45:04 -0600

Seen: 584 times

Last updated: Dec 13 '14