/python/

Test RIA cross domain policy

2016-12-20 21:23:32

Test RIA cross domain policy

import urllib.request
import urllib.parse

ria_meta_file = ['crossdomain.xml', 'clientaccesspolicy.xml']

page_url = 'https://twitter.com/'

for _file in ria_meta_file:
    print("------ File test: " + _file + " ------")
    try:
        req = urllib.request.Request(
                page_url + _file,
                method='GET'
        )

        response = urllib.request.urlopen(req)
        body = response.read().decode('utf8')
        print(body)

    except:
        print('Error')