Python Forum
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python code for scraping
#1
Would like to learn more about how to scrape data using openchargemap.org/site/develop/api
for the tinkering around.
Specifically, extract all the point data (with attributes) from their main database.
Have read through their docs / dev  and don't see a clear cut way to access this data.

Was given the following code on a forum to do this here, **note** i had to remove
https://  
from resp = requests.get('______ api.openchargemap.io/v2/poi/')
since clickable links are not allowed yet.

import requests

resp = requests.get('api.openchargemap.io/v2/poi/')
data = resp.json()

for d in data:
    id = d['ID']
    operator_id = d['OperatorID']
    lat = d['AddressInfo']['Latitude']
    lon = d['AddressInfo']['Longitude']
        print('{0} | {1} | {2} | {3}'.format(id, operator_id, lat, lon))  
which produces:
SyntaxError: multiple statements found while compiling a single statement
and when running just
import requests
get the following:
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
Downloaded and installed Python 3.6.1 (i was on 2.7 which i did not uninstall) using Windows 7 with Python 3.6.1 Shell
Any help would be appreciated.
Reply


Messages In This Thread
python code for scraping - by sirgeo - Mar-28-2017, 03:53 PM
RE: python code for scraping - by wavic - Mar-28-2017, 04:02 PM
RE: python code for scraping - by sirgeo - Mar-28-2017, 04:23 PM
RE: python code for scraping - by snippsat - Mar-28-2017, 04:06 PM
RE: python code for scraping - by snippsat - Mar-28-2017, 04:42 PM
RE: python code for scraping - by sirgeo - Mar-28-2017, 05:38 PM
RE: python code for scraping - by snippsat - Mar-28-2017, 06:17 PM
RE: python code for scraping - by sirgeo - Mar-28-2017, 06:32 PM
RE: python code for scraping - by metulburr - Mar-28-2017, 06:49 PM
RE: python code for scraping - by sirgeo - Mar-28-2017, 06:49 PM
RE: python code for scraping - by snippsat - Mar-28-2017, 07:06 PM
RE: python code for scraping - by metulburr - Mar-28-2017, 07:14 PM
RE: python code for scraping - by sirgeo - Mar-28-2017, 07:30 PM
RE: python code for scraping - by snippsat - Mar-28-2017, 11:19 PM
RE: python code for scraping - by metulburr - Mar-28-2017, 11:39 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020