GAE http error 400

87 views
Skip to first unread message

esoma

unread,
Nov 11, 2011, 10:29:14 PM11/11/11
to Justin.tv API Developers
I've got an application running on Google App Engine in Python. I'm
trying to use the REST API (list.json specifically). When I fetch the
url on my local test environment everything works, but when I deploy
on to Google's service I only receive Http Error 400: Bad Request
responses. I can access other APIs (like LiveStream's) just fine.

I tried using oAuth, but got the exact same results. I've tried
performing non-api requests just to the justin.tv homepage and still
get the 400 error. Does justin.tv block GAE requests or something?

Mike Ossareh

unread,
Nov 14, 2011, 1:28:27 PM11/14/11
to justintv-ap...@googlegroups.com
Hi Esoma,

What is the URL you're trying to hit?


Cheers,

mike


--
You received this message because you are subscribed to the Google Groups "Justin.tv API Developers" group.
To post to this group, send email to justintv-ap...@googlegroups.com.
To unsubscribe from this group, send email to justintv-api-deve...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/justintv-api-developers?hl=en.


esoma

unread,
Nov 14, 2011, 5:21:44 PM11/14/11
to Justin.tv API Developers
http://api.justin.tv/api/stream/list.json?channel=channelName1,channelName2,etc...

But like I said, I get the same status 400 response for any justin.tv
url requested from GAE's production environment.

Mike Ossareh

unread,
Nov 14, 2011, 7:47:01 PM11/14/11
to justintv-ap...@googlegroups.com
Hi Esoma,

If you give us the full request, headers and all then we'll be able to help debug this. As far as we know there is no reason for GAE to not work, but it could be something subtle like a header being set that we disagree with. So, yeah, provide us as much info as you can and we'll do our best to help you out.

Cheers,

mike

Mike Ossareh

unread,
Nov 14, 2011, 9:18:25 PM11/14/11
to justintv-ap...@googlegroups.com
A little more digging suggests this may be to do with the GAE user agent. 

Try setting one[1][2], see what happens. I'll continue to look into why this might be causing an issue.

Cheers,

esoma

unread,
Nov 14, 2011, 10:46:48 PM11/14/11
to Justin.tv API Developers
Alright so I diffed the headers. Only change is the User-Agent.

Development (Working):
User-Agent: AppEngine-Google; (+http://code.google.com/appengine)

Production (Error 400 Bad Request):
User-Agent: AppEngine-Google; (+http://code.google.com/appengine;
appid: s~ponystreams)

Since I can't spoof it in GAE I wrote a php script and tried with both
User-Agents on my regular website. Sure enough the production one with
"; appid: s~ponystreams" added on fails. So I tried a bunch more
changing parts around to see what works and what doesn't. Came to the
conclusion that a colon, a space, and then any other character
anywhere in the User-Agent string causes the bad request. So valid
ones might look like:

'Something : '
'Something:123'
':'
': '

Invalid:

'Something : ;'
'Something: (something else)'
': x'


I'd remove it from the User-Agent myself, but GAE doesn't allow that.

On Nov 14, 6:18 pm, Mike Ossareh <ossa...@twitch.tv> wrote:
> A little more digging suggests this may be to do with the GAE user agent.
>
> Try setting one[1][2], see what happens. I'll continue to look into why
> this might be causing an issue.
>
> Cheers,
>
> mike
>
> [1]http://stackoverflow.com/questions/2743521/how-to-change-user-agent-o...
> [2]http://code.google.com/p/googleappengine/issues/detail?id=342
>
>
>
>
>
>
>
> On Mon, Nov 14, 2011 at 4:47 PM, Mike Ossareh <ossa...@twitch.tv> wrote:
> > Hi Esoma,
>
> > If you give us the full request, headers and all then we'll be able to
> > help debug this. As far as we know there is no reason for GAE to not work,
> > but it could be something subtle like a header being set that we disagree
> > with. So, yeah, provide us as much info as you can and we'll do our best to
> > help you out.
>
> > Cheers,
>
> > mike
>
> > On Mon, Nov 14, 2011 at 2:21 PM, esoma <stillusing...@gmail.com> wrote:
>
> >>http://api.justin.tv/api/stream/list.json?channel=channelName1,channe....
> >> ..

Mike Ossareh

unread,
Nov 14, 2011, 10:51:04 PM11/14/11
to justintv-ap...@googlegroups.com

Hey,

Yeah, you've identified that correctly. We've looked at our nginx configs and do not see anything on our side that would cause this.

We'll dig some more though.

Reply all
Reply to author
Forward
0 new messages