alex9smith / gdelt-doc-api

A Python client for the GDELT 2.0 Doc API
MIT License
100 stars 23 forks source link

Workaround for 'requests' Package #27

Open sophiestrazie opened 1 year ago

sophiestrazie commented 1 year ago

Error Message: AttributeError: module 'requests' has no attribute 'get'

Issue Is there a workaround? I tried importing requests and gd directly (commented out), but it didn't help. I used the same code on the main page starter code for this api.

Note: According to this article, I may have this issue if there is another requests file on my system. Unfortunately, I have no other python file with this title.

System Info

Part 1: This Code Worked

# import gdeltdoc as gd
# import requests
from gdeltdoc import GdeltDoc, Filters

f = Filters(keyword = "climate change", start_date = "2020-05-10", end_date = "2020-05-11")

gd = GdeltDoc()

Part 2: This Produced the Error

# Search for articles matching the filters
# problem
articles = gd.article_search(f)

AttributeError: module 'requests' has no attribute 'get'

Part 3: This Code Same Error

# Get a timeline of the number of articles matching the filters
# problem
timeline = gd.timeline_search("timelinevol", f)

AttributeError: module 'requests' has no attribute 'get'