mirror of
https://github.com/balkian/bitter.git
synced 2024-12-22 00:18:12 +00:00
Changed versioning, added locks
This commit is contained in:
parent
39726a12d9
commit
09feb050a6
@ -1,6 +1,7 @@
|
|||||||
include requirements.txt
|
include requirements.txt
|
||||||
include test-requirements.txt
|
include test-requirements.txt
|
||||||
include README.md
|
include README.md
|
||||||
|
include bitter/VERSION
|
||||||
graft bitter/templates
|
graft bitter/templates
|
||||||
graft bitter/static
|
graft bitter/static
|
||||||
graft test
|
graft test
|
||||||
|
1
bitter/VERSION
Normal file
1
bitter/VERSION
Normal file
@ -0,0 +1 @@
|
|||||||
|
0.5.4
|
@ -3,8 +3,15 @@ Bitter module. A library and cli for Twitter using python-twitter.
|
|||||||
http://github.com/balkian/bitter
|
http://github.com/balkian/bitter
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from future.standard_library import install_aliases
|
try:
|
||||||
install_aliases()
|
from future.standard_library import install_aliases
|
||||||
|
install_aliases()
|
||||||
|
except ImportError:
|
||||||
|
# Avoid problems at setup.py and py3.x
|
||||||
|
pass
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from .version import __version__
|
||||||
|
|
||||||
__version__ = '0.5.0'
|
|
||||||
__all__ = ['cli', 'config', 'crawlers', 'models', 'utils' ]
|
__all__ = ['cli', 'config', 'crawlers', 'models', 'utils' ]
|
||||||
|
@ -8,6 +8,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
from twitter import *
|
from twitter import *
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
from threading import Lock
|
||||||
from . import utils
|
from . import utils
|
||||||
from . import config
|
from . import config
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ class TwitterWorker(object):
|
|||||||
self.name = name
|
self.name = name
|
||||||
self.client = client
|
self.client = client
|
||||||
self.throttled_time = False
|
self.throttled_time = False
|
||||||
|
self._lock = Lock()
|
||||||
self.busy = False
|
self.busy = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -76,6 +78,7 @@ class TwitterQueue(AttrToFunc):
|
|||||||
c = None
|
c = None
|
||||||
try:
|
try:
|
||||||
c = self.next()
|
c = self.next()
|
||||||
|
c._lock.acquire()
|
||||||
c.busy = True
|
c.busy = True
|
||||||
logger.debug('Next: {}'.format(c.name))
|
logger.debug('Next: {}'.format(c.name))
|
||||||
ping = time.time()
|
ping = time.time()
|
||||||
@ -97,6 +100,7 @@ class TwitterQueue(AttrToFunc):
|
|||||||
finally:
|
finally:
|
||||||
if c:
|
if c:
|
||||||
c.busy = False
|
c.busy = False
|
||||||
|
c._lock.release()
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
4
bitter/version.py
Normal file
4
bitter/version.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
with open(os.path.join(os.path.dirname(__file__), 'VERSION')) as f:
|
||||||
|
__version__ = f.read().strip()
|
@ -1 +1,2 @@
|
|||||||
contextlib2
|
contextlib2
|
||||||
|
future
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
sqlalchemy
|
sqlalchemy
|
||||||
twitter
|
twitter
|
||||||
click
|
click
|
||||||
future
|
|
||||||
|
8
setup.py
8
setup.py
@ -23,16 +23,12 @@ if sys.version_info <= (3, 0):
|
|||||||
install_reqs = [str(ir.req) for ir in install_reqs]
|
install_reqs = [str(ir.req) for ir in install_reqs]
|
||||||
test_reqs = [str(ir.req) for ir in test_reqs]
|
test_reqs = [str(ir.req) for ir in test_reqs]
|
||||||
|
|
||||||
with open('bitter/__init__.py') as f:
|
from bitter import __version__
|
||||||
exec(f.read())
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="bitter",
|
name="bitter",
|
||||||
packages=['bitter'],
|
packages=['bitter'],
|
||||||
description='''
|
description=" Simplifying how researchers access Data. It includes a CLI and a library.",
|
||||||
Simplifying how researchers access Data.
|
|
||||||
It includes a CLI and a library.
|
|
||||||
''',
|
|
||||||
author='J. Fernando Sanchez',
|
author='J. Fernando Sanchez',
|
||||||
author_email='balkian@gmail.com',
|
author_email='balkian@gmail.com',
|
||||||
url="http://balkian.com",
|
url="http://balkian.com",
|
||||||
|
Loading…
Reference in New Issue
Block a user