This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ftplib | |
| # connect to the server | |
| ftp = ftplib.FTP('ftp.ncdc.noaa.gov') #pass the url without protocol | |
| ftp.login() #pass credentials if anonymous access is not allowed | |
| # switch to the directory containing the data | |
| ftp.cwd('/pub/data/swdi/database-csv/v2/') | |
| ftp.pwd() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # token.pickle stores the user's credentials from previously successful logins | |
| if os.path.exists('token.pickle'): | |
| print('Loading Credentials From File...') | |
| with open('token.pickle', 'rb') as token: | |
| credentials = pickle.load(token) | |
| # Google's Request | |
| from google.auth.transport.requests import Request |