views:

23

answers:

1

Is querying for URLs present on ports other than 80 allowed with urlfetch()

I would like to get data from a server on a non-standard port -

http://example.com:8000/WebService?input=a

Ideal example would be web services hosted on non-standard ports.

Can i do this somehow with appengine?

+3  A: 

The app engine documentation says that you can use Python's urllib2 to make your requests which will automatically use Google's urlfetch service. Using urllib2 you can indicate the port number in the hostname.

import urllib2
conn = urllib2.urlopen('http://www.google.com:80')
print conn.read()

I haven't tested it on GAE, but I don't see why it shouldn't work.

Edit:

From the GAE documentation:

The URL to be fetched can use any port number in the following ranges: 80-90, 440-450, 1024-65535. If the port is not mentioned in the URL, the port is implied by the scheme: http://... is port 80, https://... is port 443.

This implies that the port can be specified in the url while using the standard urlfetch API.

advait
thanks! RTFM for me i guess :)
demos