Tuesday, January 12, 2021

try to download PDF from google drive (unsuccessful attemp)

 

import sys

sys.path.append("/opt/anaconda3/lib/python3.7/site-packages")


import requests

from bs4 import BeautifulSoup as soup

from urllib import parse

import os

import re

import pandas as pd


tb = pd.read_excel('Submission of Report _ Lesson plan, online-R-coding bootcamp Dec 2020 (Responses).xlsx')

doc_urls = tb['Please upload your report (for students) or lesson plans (for teachers) in PDF format']

type( doc_urls )
doc_urls[1]
content = requests.get(doc_urls[1] )
with open(("test.pdf"), 'wb') as pdf:
    pdf.write(content.content)
dir(content)

#The generated pdf cannot be open. It is an html file. 


No comments:

Post a Comment