[英]Python Web scraping - How to locate the Co-ordinates of the map element?
[英]How to send co-ordinates with Tweepy and Python to Twitter status update
我想使用Python 2.7和Tweepy通過消息和一些地理坐標向Twitter發送狀態更新。 我已經使用了Tweepy很多,其他所有東西都可以正常工作,但是當我嘗試傳遞坐標時,會得到“無效坐標”。 信息...坐標本身是Bing API的整數。
請參閱此處以獲取tweepy要求: http ://docs.tweepy.org/en/v3.5.0/api.html
我正在執行的代碼:
latitude = 51.5118029
longitude = -0.1337666
tweet = "Some tweet!"
api.update_status(tweet, latitude, longitude)
我得到:
raise TweepError(error_msg, resp, api_code=api_error_code)
tweepy.error.TweepError: [{u'message': u'Invalid coordinates.', u'code': 3}]
任何幫助,不勝感激!
嘗試這個:
api.update_status(tweet, lat=latitude, long=longitude)
沒有lat
和long
參數名稱,tweepy認為您正在提供in_reply_to_status_id
。 這是實際的方法聲明:
API.update_status(status[, in_reply_to_status_id][, lat][, long][, source][, place_id])
結果(毫不奇怪),您需要聲明緯度/經度,即
api.update_status(tweet, lat = latitude, long = longitude)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.