GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — ticketmaster-api-alternative/python_example.py at main · ticketsdata/ticketmaster-api-alternative Expand file tree/ Copy pathpython_example.pyMore file actions 42 lines (34 loc) · 1.19 KB / Copy pathpython_example.pyFile metadata and controls42 lines (34 loc) · 1.19 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 """Fetch live listings for one event with the TicketsData API. Usage: export TD_USERNAME="[email protected]" export TD_PASSWORD="your-password" python python_example.py ticketmaster "https://www.ticketmaster.com/event/160062583FD9756B" """ import os import sys import time import requests BASE_URL = "https://ticketsdata.com" RETRY_CODES = {503, 504} def fetch(platform, event_url, mode=None): params = { "username": os.environ["TD_USERNAME"], "password": os.environ["TD_PASSWORD"], "platform": platform, "event_url": event_url, } if mode: params["mode"] = mode for wait in (0, 1.5, 3): time.sleep(wait) r = requests.get(f"{BASE_URL}/fetch", params=params, timeout=60) if r.status_code not in RETRY_CODES: break r.raise_for_status() return r.json() if __name__ == "__main__": if len(sys.argv) < 3: sys.exit("Usage: python python_example.py <platform> <event_url> [mode]") data = fetch(sys.argv[1], sys.argv[2], sys.argv[3] if len(sys.argv) > 3 else None) print(f'{data["platform"]}: HTTP {data["status"]} in {data["response_s"]}s') print("Credits left:", data["quota_remaining"]) |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |