Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running demo.py error bad request for url http://localhost:9091/rest/selection #1

Open
JunjieChen-2020 opened this issue Jan 21, 2022 · 3 comments

Comments

@JunjieChen-2020
Copy link

image
I have a question about this picture.
I can not find error in the configuration phase.
can you help me to fix the problem?
thank you

@chenzhao
Copy link
Member

Hi. I think you should check the server log for more details. Usually you will find some corresponding codes for this 400 error.

@JunjieChen-2020
Copy link
Author

Hi. I think you should check the server log for more details. Usually you will find some corresponding codes for this 400 error.

Hi, I think the code in demo.py 47line, the response data as /rest/selection parameters has a problem.
API create_hit return response :
{'brief': 'selection DN7Z7CBJ',
'hit_id': {u'status':
u'open',
u'attachment_id': None,
u'description': u'HIT descriptionCPKPQ5MR',
u'title': u'test selection HIT JPZVAG9M',
u'min_selection_count': 1,
u'type': u'selection',
u'campaign_id': 6,
u'required_answer_count': 3,
u'credit': 10,
u'created_on':
u'2022-02-06T17:45:31',
u'end_time': u'2022-02-07T17:45:31',
u'begin_time': u'2022-02-06T17:45:31',
u'requester_id': 6,
u'location_id': 6,
u'id': 12,
u'max_selection_count': 1}}

就是这个返回的结果作为 selection = client.create_selection(hit_id, 'selection ' + randstr())的输入出错。我是否需要把u去掉?

@chenzhao
Copy link
Member

chenzhao commented Feb 9, 2022

试一下吧。这份代码记得是python2的,如果你是用py3的话有可能是这个问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants