#!/usr/bin/env python
from nose.tools import set_trace
import json
import os
import sys
bin_dir = os.path.split(__file__)[0]
package_dir = os.path.join(bin_dir, "..", "..")
sys.path.append(os.path.abspath(package_dir))

from core.scripts import IdentifierInputScript
from api.overdrive import OverdriveAPI

class OverdriveRawCirculationScript(IdentifierInputScript):
    def run(self):
        overdrive = OverdriveAPI(self._db)
        args = self.parse_command_line(self._db)
        for identifier in args.identifiers:
            book_id, (status_code, headers, content) = overdrive.circulation_lookup(
                  identifier.identifier
            )
            data = json.loads(content)
            print json.dumps(data, sort_keys=True, indent=4,
                             separators=(',', ': '))
            print

OverdriveRawCirculationScript().run()

2ccafb5053f3ea00ced3c5a0fccb0b3267741562
#!/usr/bin/env python
from nose.tools import set_trace
import json
import os
import sys
bin_dir = os.path.split(__file__)[0]
package_dir = os.path.join(bin_dir, "..", "..")
sys.path.append(os.path.abspath(package_dir))

from core.scripts import IdentifierInputScript
from api.overdrive import OverdriveAPI

class OverdriveRawCirculationScript(IdentifierInputScript):
    def run(self):
        overdrive = OverdriveAPI(self._db)
        args = self.parse_command_line(self._db)
        for identifier in args.identifiers:
            book_id, (status_code, headers, content) = overdrive.circulation_lookup(
                  identifier.identifier
            )
            data = json.loads(content)
            print json.dumps(data, sort_keys=True, indent=4,
                             separators=(',', ': '))
            print

OverdriveRawCirculationScript().run()
