Closed factorlive closed 3 years ago
Do you have a short code example?
Thanks for the swift response. Yes.
The response gets you the first 100 followers, i.e. first page.
from TwitterAPI import TwitterAPI, TwitterPager
from dotenv import load_dotenv
load_dotenv()
api = TwitterAPI(os.getenv("CONSUMER_KEY"), os.getenv("CONSUMER_SECRET"),
os.getenv("TOKEN"), os.getenv("SECRET"), api_version='2')
pager = TwitterPager(api, 'users/:1314235041841643520/following')
counter = 0
for item in pager.get_iterator(new_tweets=False):
print(item)
counter += 1
print(counter)
When looking at the response object, I do see the next token. The TypeError suggests it was not supplied. I also tried playing with the new_tweets parameter to see whether such would cause the error. However, I had no luck.
from TwitterAPI import TwitterAPI, TwitterPager
from dotenv import load_dotenv
load_dotenv()
api = TwitterAPI(os.getenv("CONSUMER_KEY"), os.getenv("CONSUMER_SECRET"),
os.getenv("TOKEN"), os.getenv("SECRET"), api_version='2')
r = api.request('users/:1314235041841643520/following')
data = r.json()
print(data["meta"]["next_token"])
Okay, I see the issue in the TwitterPager
code. Should have a fix soon.
Well done. Look forward to it. I didn't spot it. The pager is very handy. 🎊🎆
It should be fixed in version 2.6.6. You can download it now.
Works. ✅
Hi,
Whenever I am about to reach the next page with the helper class TwitterPager, I hit the TypeError below. So I can only retrieve the first page.
Tested on endpoints:
The endpoint in the example does work for me. Also, weirdly, I can retrieve the meta next_token from the r.json() object.
Working with Python 3.9 on Ubuntu 20.
Any ideas? 😕