예제 #1
0
파일: tests.py 프로젝트: dv-dev/scalpyr
    def test_send_request_with_key(self):
        with patch.object(requests, 'get') as get:
            scalpyr = Scalpyr(dev_key=1234)
            get.return_value.text = json.dumps(dict(testing='test'))
            get.return_value.status_code = 200

            results = scalpyr._send_request('testing', dict(testing='test'))

            get.assert_called_with('http://api.seatgeek.com/2/testing/?testing=test&client_id=1234')
예제 #2
0
파일: tests.py 프로젝트: dv-dev/scalpyr
    def test_send_request(self):
        with patch.object(requests, 'get') as get:
            scalpyr = Scalpyr()
            get.return_value.text = json.dumps(dict(testing='test'))
            get.return_value.status_code = 200

            results = scalpyr._send_request('testing', dict(testing='test'))

            get.assert_called_with('http://api.seatgeek.com/2/testing/?testing=test&')
            self.assertEqual(results['testing'], 'test')
예제 #3
0
import csv
from flask import redirect, render_template, request, session, url_for
from functools import wraps
from cs50sql import SQL as SQL
import datetime
from scalpyr import Scalpyr
seatgeek = Scalpyr()

# configure CS50 Library to use SQLite database
db = SQL("sqlite:///tickets.db")


# Logs the current price data (ave, low, high, volume) for concert in table data (only call this on concerts that haven't happened)
def logData(id):
    try:
        # Searching for concerts ranked from most to least popular.... added in using a name to do it
        request_args = {"id": id}
        events = seatgeek.get_events(request_args)

        data = events['events'][0]['stats']
        loPrice = data["lowest_price"]
        if loPrice != None:
            # Parse through dictionary to get prices
            avPrice = data["average_price"]
            loPrice = data["lowest_price"]
            hiPrice = data["highest_price"]
            volume = data["listing_count"]
            social = "0"
        else:
            avPrice = "0"
            loPrice = "0"