Ask Your Question
1

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 gravatar image

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

Evgeny gravatar image

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?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

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

Evgeny gravatar image

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

edit flag offensive delete link more

Comments

Great, thanks Evgeny!

tim gravatar imagetim ( 2014-12-13 19:02:45 -0600 )edit
0

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

tim gravatar image

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

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 gravatar imageEvgeny ( 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

Stats

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

Seen: 133 times

Last updated: Dec 13 '14