简体   繁体   中英

A Most Frustrating Issue Between App Engine and the Twitch.tv API

I'll make this as short and as clear as I can.

I have a simple application making a call to the twitch.tv api:

Example:

https://api.twitch.tv/kraken/streams/nl_kripp

After it makes the call, it returns the data, (you could see that data if click the link above).

Ok so on to the issue. Here is my simple application created to just return that data on a web page:

import webapp2
import urllib2
from google.appengine.api import urlfetch



class MainHandler(webapp2.RequestHandler):
    def get(self):
        url = ('https://api.twitch.tv/kraken/streams/nl_kripp')
        result = urlfetch.fetch(url)
        self.response.out.write(result.content)

app = webapp2.WSGIApplication([('/', MainHandler)],
                              debug=True)

When I run this application on my local machine, I see the returned data and everything is fine. However, when I deploy the application, I don't see any data at all.

That exact application is deployed at this URL:

http://urltestingsite.appspot.com/

A few people from app engine as well as twitch have tried to figure this out, and have had no luck at all. Please help me!!!

EDIT:

This is the same app, however making a call to another streaming sites API (own3d) and it works perfectly even when deployed:

import webapp2
import urllib2

class MainHandler(webapp2.RequestHandler):
    def get(self):
        url = ('http://api.own3d.tv/liveCheck.php?live_id=10588')
        contents = urllib2.urlopen(url)
        self.response.out.write(contents.read())


app = webapp2.WSGIApplication([('/', MainHandler)],
                              debug=True)

I don't know anything about these particular sites, but it isn't uncommon for sites to blacklist either by user agent or by IP address, possibly because of some prior bad actor. If you're getting results when developing but not when deployed, I'd suspect the latter. Have you contacted the site?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM