Exemplo n.º 1
0
def post_request(query, type_id):
    data = requests.post(url='http://overpass.hotosm.org/api/interpreter',
                         data={'data': query},
                         headers={'User-Agent': 'HotOSM'},
                         stream=True)

    f = open('/tmp/{}.xml'.format(type_id), 'w')
    for line in data.iter_lines():
        if line:
            decoded_line = line.decode('utf-8')
            f.write(decoded_line)
    f.close()
Exemplo n.º 2
0
def post_request(query, feature):
    data = requests.post(
        # url='http://overpass-api.de/api/interpreter',
        url='http://exports-prod.hotosm.org:6080/api/interpreter',
        data={'data': query},
        headers={'User-Agent': 'HotOSM'},
        stream=True)

    f = open('/tmp/attic_{feature}.xml'.format(feature), 'w')
    for line in data.iter_lines():
        if line:
            decoded_line = line.decode('utf-8')
            f.write(decoded_line)
    f.close()