Python Forum
Problems with using request in python 3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems with using request in python 3
#1
Im new to Python, and Im learning it fro the new boston's guide on youtube.
im having trouble downloading csv files through python.
this is the code -

from urllib import request

goog_url = 'http://www.google.com/finance/historical?q=NASDAQ:GOOG&output=csv'


def download_stock_data(csv_url):
    response = request.urlopen(csv_url)
    csv = response.read()
    csv_str = str(csv)
    lines = csv_str.split("\\n")
    dest_url = r'goog.csv'
    fx = open(dest_url, "w")
    for line in lines:
        fx.write(line + "\n")
    fx.close()

download_stock_data(goog_url)
The error im receiving is-

Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/untitled/New_Boston_ep_24.py", line 1, in <module>
from urllib.request import urlopen
ImportError: No module named request



PS im new to forums, so let me know if i made any mistake in posting. Help is appreciated
Reply


Messages In This Thread
Problems with using request in python 3 - by Maaniac - Feb-15-2018, 03:53 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Debian 11 Bullseye | Python 3.9.x | pip install mysql-connector-python-rf problems BrandonKastning 4 6,703 Feb-05-2022, 08:25 PM
Last Post: BrandonKastning
  how can I correct the Bad Request error on my curl request tomtom 8 5,089 Oct-03-2021, 06:32 AM
Last Post: tomtom
  Python Request Errors PythonNoob1998 7 3,990 Jan-07-2021, 05:18 PM
Last Post: buran
  ImportError: cannot import name 'Request' from 'request' abhishek81py 1 3,946 Jun-18-2020, 08:07 AM
Last Post: buran

Forum Jump:

User Panel Messages

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