import sys from iris_sdk import Client, Tns, RestError if len(sys.argv) < 2: sys.exit("usage: python tns_details.py [number], e.g.:" + "\npython tns_details.py 4109235436") tns = Tns(client=Client(filename="config.cfg")) print("\n") try: details = tns.get(sys.argv[1]).tndetails.get() except RestError as error: sys.exit(error) print(" account: " + (details.account_id or "")) print(" city: " + (details.city or "")) print(" last modified: " + (details.last_modified_date or "")) print(" LATA: " + (details.lata or "")) print(" rate center: " + (details.rate_center or "")) print(" state: " + (details.state or "")) print(" tier: " + (details.tier or "")) print(" vendor id: " + (details.vendor_id or "")) print(" vendor name: " + (details.vendor_name or "")) print(" dlda") print(" city: " + (details.features.dlda.address.city or "")) print(" listing: ") print(" first name" +
import sys from iris_sdk import Account, Client, RestError if len(sys.argv) < 3: sys.exit("usage: python npa_nxx_search.py [area code] [quantity], e.g.:" + "\npython npa_nxx_search.py 435 1") acc = Account(client=Client(filename="config.cfg")) print("\n") try: available_npa = acc.available_npa_nxx.list( {"areaCode": sys.argv[1], "quantity": sys.argv[2]}) except RestError as error: sys.exit(error) for phone_number in available_npa.items: print(" - ") print(" city: " + (phone_number.city or "")) print(" NPA: " + (phone_number.npa or "")) print(" NXX: " + (phone_number.nxx or "")) print(" state: " + (phone_number.state or "")) print(" quantity: " + (phone_number.quantity or ""))
import sys from iris_sdk import Cities, Client, RestError if len(sys.argv) < 2: sys.exit("usage: python cities.py [state], e.g.:\n python cities.py NJ") cities = Cities(client=Client(filename="config.cfg")) print("\n") try: cities_list = cities.list({"state": sys.argv[1]}) except RestError as error: sys.exit(error) print("\ntotal for search: " + (cities.result_count or "")) for city in cities_list.items: print((city.rc_abbreviation or "") + " (" + (city.name or "") + ")")
import sys from iris_sdk import Client, RateCenters, RestError if len(sys.argv) < 2: sys.exit("usage: python rate_center.py [state], e.g.:\n" + "python rate_center.py NJ") rate_centers = RateCenters(client=Client(filename="config.cfg")) print("\n") try: centers = rate_centers.list({"state": sys.argv[1]}) except RestError as error: sys.exit(error) print("\ntotal for search: " + (rate_centers.total_count or "")) for rc in centers.items: print((rc.abbreviation or "") + " (" + (rc.name or "") + ")")
completed_quantity = response.completed_quantity completed_numbers = response.completed_numbers print("Tried to order Numbers:") for number in original_numbers.items: print(number) print(f"Of those numbers, {completed_quantity} were successful:") for number in response.completed_numbers.items: print(number) print(f"Of those numbers, {failed_quantity} were unsuccessful:") for number in response.failed_numbers.items: print(number) return if __name__ == '__main__': my_account = Account(client=Client( filename="config.cfg")) # Comment this line to use the config file # Uncomment these lines to use environment variables # BANDWIDTH_ACCOUNT_ID = os.environ["BANDWIDTH_ACCOUNT_ID"] # BANDWIDTH_API_USER = os.environ["BANDWIDTH_API_USER"] # BANDWIDTH_API_PASSWORD = os.environ["BANDWIDTH_API_PASSWORD"] # client = Client(url="https://dashboard.bandwidth.com/api", # account_id=BANDWIDTH_ACCOUNT_ID, # username=BANDWIDTH_API_USER, # password=BANDWIDTH_API_PASSWORD) # my_account = Account(client=client) if len(sys.argv) < 2: sys.exit("usage: python order_get.py [site/subbacount-id], e.g.:" + "\npython order_get.py 23360") my_site_id = sys.argv[1] my_order_id = search_and_order(my_account, my_site_id)