Skip to content

Commit

Permalink
Importing __version__ from __init__.py fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoepp committed Jul 30, 2013
1 parent 580f651 commit c172721
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
15 changes: 15 additions & 0 deletions TwitterSearch/TwitterSearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class TwitterSearch(object):
_base_url = 'https://api.twitter.com/1.1/'
_verify_url = 'account/verify_credentials.json'
_search_url = 'search/tweets.json'
_lang_url = 'help/languages.json'

# see https://dev.twitter.com/docs/error-codes-responses
exceptions = {
Expand Down Expand Up @@ -153,6 +154,20 @@ def getStatistics(self):
""" Returns dict with statistical information about amount of queries and received tweets """
return self.__statistics

def setSupportedLanguages(self, order):
""" Loads currently supported languages from Twitter API and sets them in a given TwitterSearchOrder instance """
if not isinstance(order, TwitterSearchOrder):
raise TwitterSearchException(1010)

r = requests.get(self._base_url + self._lang_url, auth=self.__oauth, proxies=self.__proxy)
self.__response['meta'] = r.headers
self.checkHTTPStatus(r.status_code)
self.__response['content'] = r.json()

order.iso_6391 = []
for lang in self.__response['content']:
order.iso_6391.append(lang['code'])

# Iteration
def __iter__(self):
if not self.__response:
Expand Down
2 changes: 1 addition & 1 deletion TwitterSearch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = 'TwitterSearch'
__version__ = '0.77'
__version__ = '0.78.1'
__author__ = 'Christian Koepp'
__license__ = 'MIT'
__copyright__ = 'Copyright 2013 Christian Koepp'
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from setuptools import setup
from TwitterSearch import __version__
#from TwitterSearch import __version__

def readme():
with open('README.md') as f:
Expand All @@ -12,7 +12,7 @@ def requirements():
return req

setup(name='TwitterSearch',
version=__version__,
version='0.78.1',
description='A library to easily iterate tweets found by the Twitter Search API',
long_description=readme(),
url='http://github.com/ckoepp/TwitterSearch',
Expand Down
1 change: 1 addition & 0 deletions tests/mock-data/lang.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"name": "Finsk","code": "fi","status": "production"},{"name": "Dansk","code": "da","status": "production"},{"name": "Polsk","code": "pl","status": "production"},{"name": "Ungarsk","code": "hu","status": "production"},{"name": "Farsi","code": "fa","status": "production"},{"name": "Hebraisk","code": "he","status": "production"}]

0 comments on commit c172721

Please sign in to comment.