arcapi.request

Here are the examples of the python api arcapi.request taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

Example 1

Project: arcapi Source File: arcapi_test.py
    def testrequest_json(self):
        """Get json from arcgis sampleserver"""
        u = 'http://sampleserver3.arcgisonline.com/ArcGIS/rest/services'
        d = ap.request(u, {'f':'json'}, 'json')
        items = [
            isinstance(d, dict),
            isinstance(d.get('services'), list),
            isinstance(d.get('folders'), list),
            isinstance(d.get('currentVersion'), int)
        ]
        self.assertTrue(all(items))

Example 2

Project: arcapi Source File: arcapi_test.py
Function: test_request_xml
    def testrequest_xml(self):
        """Get XML from epsg.io"""
        u = 'http://epsg.io/4326.xml'
        d = ap.request(u, None, 'xml')

        tg = str(d.tag)
        tp = '{http://www.opengis.net/gml/3.2}GeographicCRS'

        self.assertEqual(tg, tp)

Example 3

Project: arcapi Source File: arcapi_test.py
    def testrequest_text(self):
        """Basic test to get a page as text"""
        d = ap.request('http://google.com')
        self.assertNotEqual(d, '')