11from uuid import uuid4
22
3+ # services - async action handlers
4+ ASYNC_TASKS_RECEIVER_PORT = 8100
5+ MAIL_RECEIVER_PORT = 8200
6+ SERVICE_LOCALHOST = 'localhost'
7+
38ANTIBOT_JS_CODE_URL = "https://epsf.ticketmaster.com/eps-d"
49TOKEN_INTERROGATION_URL = "https://epsf.ticketmaster.com/eps-d?d=www.ticketmaster.com"
510
@@ -17,16 +22,39 @@ def get_top_picks_url(
1722 "BEST_AVAILABLE_SEATS" : "best-available-seats" ,
1823 "BEST_HISTORY_SEATS" : "best-history-seats"
1924}
25+
26+ SUBSCRIBE_REQUEST_PROPS = {
27+ 'NAME' : 'name' ,
28+ 'TARGET_PRICE' : 'target_price' ,
29+ 'TOLERANCE' : 'tolerance' ,
30+ 'TICKET_NUM' : 'ticket_num' ,
31+ 'TM_EVENT_ID' : 'tm_event_id'
32+ }
33+
34+ def filter_obj_from_attrs (obj , atts : dict [str ,str ]):
35+ res = {}
36+ for key in atts .values ():
37+ if key in obj :
38+ res [key ] = obj [key ]
39+ return res
40+
41+
42+ # metric thresholds
43+ MINIMUM_HISTORY_DATA = 3
44+ PERCENT_OF_CHANGE = 0.5
45+ PERCENTILE_HISTORY_PRICES = 0.25
46+ ALERT_SEATS_MAX_COUNT = 3
47+
2048def get_top_picks_header (): return {
2149 ** BASIC_REQ_HEADER ,
2250 "tmps-correlation-id" : str (uuid4 ())
2351}
2452
25- def get_top_picks_query_params (qty , priceInterval ): return {
53+ def get_top_picks_query_params (qty : int , target_price : int , tolerance : int ): return {
2654 'show' : 'places maxQuantity sections' ,
2755 'mode' : 'primary:ppsectionrow resale:ga_areas platinum:all' ,
2856 'qty' : qty ,
29- 'q' : f"and(not(\' accessible\' ),any(listprices,$and(gte(@,{ priceInterval [ 0 ] } ),lte(@,{ priceInterval [ 1 ] } ))))" ,
57+ 'q' : f"and(not(\' accessible\' ),any(listprices,$and(gte(@,{ target_price - tolerance } ),lte(@,{ target_price + tolerance } ))))" ,
3058 'includeStandard' : 'true' ,
3159 'includeResale' : 'true' ,
3260 'includePlatinumInventoryType' : 'false' ,
0 commit comments