[{'code': 34, 'message': 'Извините, эта страница не существует.'}] - PullRequest
0 голосов
/ 05 декабря 2018
    import tweepy
    import json

    CONSUMER_KEY = ''
    CONSUMER_SECRET = ''
    OAUTH_TOKEN = ''
    OAUTH_TOKEN_SECRET = ''

    auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
    auth.set_access_token(OAUTH_TOKEN, OAUTH_TOKEN_SECRET)

    twitter_api = tweepy.API(auth)
    country_id = {'World': 1,'UK': 23424975}
    for country in country_id.keys(): 
        print (country)

    country = input("Enter the name of the place.\n")

     if country in country_id.keys():

          print ('The top 10 trending topics in ' +country+' are:')
          print ('------------------------------\n')

    PLACE_WOE_ID = country_id[country]

    place_trends = twitter_api.trends_place(_id=PLACE_WOE_ID)
    count = 1
    for trend in place_trends[0]['trends']:
        print (str(count) + ') ' + trend['name'])
        count+=1
    print ('\n Thank You for using the service.')

else:

    print (' not available.')

Я получаю следующую ошибку.Я новичок в твиттер-API и действительно сосу на исключения ... Это дает мне код 34 страницы не найден.Я не могу этого понять.Я пытаюсь отобразить тенденции конкретной страны.

Traceback (most recent call last):
  File "C:/Users/user/Documents/twipgm.py", line 44, in <module>
    place_trends = twitter_api.trends_place(_id=PLACE_WOE_ID)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tweepy\binder.py", line 250, in _call
    return method.execute()
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tweepy\binder.py", line 234, in execute
    raise TweepError(error_msg, resp, api_code=api_error_code)
tweepy.error.TweepError: [{'code': 34, 'message': 'Sorry, that page does not exist.'}]
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...