Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The 2b_retrieval2.ipynb Jupyter code does NOT work #1

Open
friendi123 opened this issue Nov 28, 2020 · 1 comment
Open

The 2b_retrieval2.ipynb Jupyter code does NOT work #1

friendi123 opened this issue Nov 28, 2020 · 1 comment

Comments

@friendi123
Copy link

Dear Dr. Kiley,

I attempted to re-run the 2b_retrieval2.ipynb program (which consists of your Python program that would enable us to retrieve information from New York Times' article database), but it appears that the "pub_date" information is missing. May you kindly double check the Jupyter program and hopefully let us know how to fix this problem?

Thanks,
Max

2020-1128_Python-NYT-API-ProgramError

@jtkiley
Copy link
Owner

jtkiley commented Nov 28, 2020

Hi, Max! In a subsequent demo, I noticed that the nytimesarticle package, which hasn't been updated in a while, no longer seems to work. I've been using pynytimes. Here's some comparable code, which is also a little nicer to use than the older package.

import datetime

import pandas as pd
from pynytimes import NYTAPI

nyt_api = NYTAPI('REDACTED')

msft_articles = nyt_api.article_search(query='Microsoft', 
                                       dates={'begin': 
                                              datetime.datetime(2018, 8, 1)})
msft_nyt = pd.DataFrame(msft_articles)
msft_nyt.head()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants