Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #200 from istresearch/hotfix-twitterapi
Browse files Browse the repository at this point in the history
Hotfix twitterapi
  • Loading branch information
andrewkcarter authored Jun 3, 2021
2 parents 68d9354 + ff92872 commit bd8d9f0
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Dockerfile.twitterapi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:2
FROM python:3.7
MAINTAINER Marti Martinez <[email protected]>

ARG BUILD_NUMBER=0
Expand All @@ -21,5 +21,5 @@ WORKDIR /usr/src/app
RUN pip install .

# Start Traptor Manager API
WORKDIR /usr/src/app/traptor/manager
CMD uwsgi --http :${TWITTER_API_PORT} -p ${TWITTER_API_WORKERS} -w wsgi
WORKDIR /usr/src/app
CMD uwsgi --http :${TWITTER_API_PORT} -p ${TWITTER_API_WORKERS} -w traptor --wsgi-file traptor/manager/wsgi.py
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ services:
- elasticsearch

twitterapi:
build: .
build:
context: .
dockerfile: Dockerfile.twitterapi
env_file:
- ./traptor.env
environment:
Expand All @@ -176,7 +178,7 @@ services:
volumes:
- ./logs:/var/log/twitterapi
restart: always
command: python traptor/manager/run.py
#command: bash -c "python -m traptor.manager.run" # To run the single threaded flask server

volumes:
logs:
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
argparse
birdy==0.2
click==6.6
connexion==1.1.10
click==8.0.1
connexion[swagger-ui]==2.7.0
datadog==0.15.0
dog-whistle==0.7.0
confluent-kafka==1.3.0
Expand All @@ -20,5 +20,5 @@ tenacity==7.0.0
urllib3==1.24.2
uwsgi==2.0.15
gevent==1.5.0
Werkzeug==0.16.1
Werkzeug==2.0.1
token-bucket==0.2.0
1 change: 0 additions & 1 deletion traptor/healthcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from threading import Thread
from scutils.log_factory import LogFactory
from dog_whistle import dw_config, dw_callback
from pykafka import KafkaClient

from .birdy.twitter import StreamClient

Expand Down
4 changes: 2 additions & 2 deletions traptor/manager/backends/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def _get_twitter():
def get_screen_name_for_userid(userid):
_get_twitter()
data = client.api.users.show.get(user_id=userid).data
return data.screen_name
return data['screen_name']

@retry_on_error
def get_userid_for_username(username):
_get_twitter()
data = client.api.users.show.get(screen_name=username).data
return data.id_str
return data['id_str']

@retry_on_error
def get_recent_tweets_by_keyword(keyword):
Expand Down
2 changes: 1 addition & 1 deletion traptor/manager/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

app = connexion.App(__name__, specification_dir=settings.API_DIR)

app.add_api(settings.API_SPEC, strict_validation=True, swagger_json=True)
app.add_api(settings.API_SPEC)

def run_server():
app.run(port=settings.API_PORT)
Expand Down
4 changes: 2 additions & 2 deletions traptor/manager/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ produces:
paths:
/validate:
post:
operationId: api.validate
operationId: traptor.manager.api.validate
summary: Validate Rule Values
consumes:
- application/json
Expand Down Expand Up @@ -40,7 +40,7 @@ paths:

/screen_name/{userid}:
get:
operationId: api.screen_name
operationId: traptor.manager.api.screen_name
summary: Get screen_name from userid.
parameters:
- in: path
Expand Down
2 changes: 1 addition & 1 deletion traptor/manager/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

app = connexion.App(__name__, specification_dir=settings.API_DIR)

app.add_api(settings.API_SPEC, strict_validation=True, swagger_json=True)
app.add_api(settings.API_SPEC)

application = app.app

0 comments on commit bd8d9f0

Please sign in to comment.