DrSkippy / Gnip-Python-Search-API-Utilities

Other
22 stars 25 forks source link

Search V2 URL questions: #35

Open fionapigott opened 7 years ago

fionapigott commented 7 years ago

It seems like there's some disagreement in this code about which URL we should be using for Search V2. I'm creating an issue instead of a pull request because I'm not sure which URL we should be using, but if we decide which is the right URL and what the expected behavior should be when the wrong URL is provided I'll submit the changes as a pull request.

1 -> url = https://gnip-api.twitter.com/search/fullarchive/accounts//dev.json
2 -> url = https://data-api.twitter.com/search/fullarchive/accounts//dev.json Both appear to work as well, as long as I comment the error statements out. Right now I'm using #1.

From gnip_search.py:

71         # Search v2 uses a different url
72         **if "gnip-api.twitter.com" in self.stream_url**:
73             self.options.search_v2 = True
74         else:
75             raise Exception("Error: Your URL appears to point to a deprecated version 1.0 endpoint. P    lease provide a version 2.0 endpoint.\n")

From gnip_time_series.py (I commented this out, and it worked):

135         **if "data-api.twitter.com" not in self.stream_url:**
136             logging.error("gnipSearch timeline tools require Search V2. Exiting.")
137             sys.stderr.write("gnipSearch timeline tools require Search V2. Exiting.\n")
138             sys.exit(-1)
blehman commented 7 years ago

"gnip-api.twitter.com" is the correct V2 url and should be the same in gnip_time_series.py. I'll update the time series script.