First time here? Check out the FAQ!
1

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

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

http://askbot.org/doc/api.html#api-v1-questions

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\base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

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

  File ".\askbot\views\api_v1.py", 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?

tim's avatar
51
tim
asked 2014-12-08 00:45:04 -0600
Evgeny's avatar
13.2k
Evgeny
updated 2014-12-13 17:29:36 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

1

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

Evgeny's avatar
13.2k
Evgeny
answered 2014-12-13 17:28:55 -0600
edit flag offensive 0 remove flag delete link

Comments

Great, thanks Evgeny!

tim's avatar tim (2014-12-13 19:02:45 -0600) edit
add a comment see more comments
0

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

tim's avatar
51
tim
answered 2014-12-08 13:11:43 -0600
edit flag offensive 0 remove flag delete link

Comments

1

`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
add a comment see more comments