Commit 14ab4b54 authored by Raphael Beer's avatar Raphael Beer

Remove: TimelineTermination experiment

parent c6bb0c3e
......@@ -13,7 +13,6 @@ import time
from aiohttp import web
from bs4 import BeautifulSoup
from db import connect
from timeline_termination import TimelineTermination
routes = web.RouteTableDef()
......@@ -450,15 +449,6 @@ class TwitterSession:
if more_replies_test and not get_nested(result, ["tests", "ghost", "ban"], False):
result["tests"]["more_replies"] = await self.test_barrier(user_id)
# if result["tests"]["search"] != False:
# try:
# debug('[TimelineTermination] Requesting status for ' + result["tests"]["search"])
# result["tests"]["timeline_termination"] = await TimelineTermination.requestTest(result["tests"]["search"], debug)
# except Exception as e:
# debug('[TimelineTermination] Request failed for ' + result["tests"]["search"])
# debug(e)
debug('Writing result for ' + result['profile']['screen_name'] + ' to DB')
db.write_result(result)
return result
......@@ -558,11 +548,9 @@ parser.add_argument('--mongo-host', type=str, default='localhost', help='hostnam
parser.add_argument('--mongo-port', type=int, default=27017, help='port of mongoDB service to connect to')
parser.add_argument('--mongo-db', type=str, default='tester', help='name of mongo database to use')
parser.add_argument('--twitter-auth-key', type=str, default=None, help='auth key for twitter guest session', required=True)
parser.add_argument('--timeline-termination-endpoint', type=str, default=None, help='endpoint of TimelineTermination test service', required=True)
args = parser.parse_args()
TwitterSession.twitter_auth_key = args.twitter_auth_key
TimelineTermination.endpoint = args.timeline_termination_endpoint
ensure_dir(args.cookie_dir)
with open(args.account_file, "r") as f:
......
from aiohttp import ClientSession
class TimelineTermination:
endpoint = None
session = ClientSession()
async def requestTest(tweet_id, debug):
async with TimelineTermination.session.get(TimelineTermination.endpoint + tweet_id) as response:
result = await response.json()
if result.get("name", None) == "APIError" and result["errors"][0]["code"] == "ENOREPLIES":
debug('[TimelineTermination] ' + tweet_id + 'has no replies - can not test.')
return None
result["tweets"]["subject"] = result["tweets"]["subject"]["tweetId"]
result["tweets"]["testedWith"] = result["tweets"]["testedWith"]["tweetId"]
return result
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment