Advertisement
Mim

kimsufi.py

Mim
Jun 3rd, 2014
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. #!/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import json
  5.  
  6. import urllib.request
  7.  
  8. with open('av.txt', 'w') as output:
  9.         data = urllib.request.urlopen('https://ws.ovh.com/dedicated/r2/ws.dispatcher/getAvailability2?callback=Request.JSONP.request_map.request_0').read()
  10.         output.write(str(data)[38:-3])
  11.  
  12. with open('av.txt') as input:
  13.         data = input.read()
  14.         availability = json.loads(data)['answer']['availability']
  15.  
  16. for item in availability:
  17.         if item['reference'] == '142sk1':
  18.                 for zone in item['zones']:
  19.                         print(zone['zone'], zone['availability'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement