generate python API testing code with postman

  1. Register on https://www.zipcodeapi.com/API to get your Application Key: 8bq9sfKQBKuI5mWg3JKFKsDdGOLaqoWXZQ6MayM3ApbQSKJ6AjmRjhxiNuRzSgki

  2. run GET on postman
    https://www.zipcodeapi.com/rest/8bq9sfKQBKuI5mWg3JKFKsDdGOLaqoWXZQ6MayM3ApbQSKJ6AjmRjhxiNuRzSgki/info.json/10095/degrees

    then click code and select python, you will get python code with requests:

  3. copy the python code into postman_api.py

    import requests
    url = "https://www.zipcodeapi.com/rest/8bq9sfKQBKuI5mWg3JKFKsDdGOLaqoWXZQ6MayM3ApbQSKJ6AjmRjhxiNuRzSgki/info.json/10095/degrees"
    payload={}
    headers = {}
    response = requests.request("GET", url, headers=headers, data=payload)
    print(response.text)
  4. run postman_api.py to verify

    C:\Users\zhuby>postman_api.py
    {"zip_code":"10095","lat":40.710028,"lng":-73.990053,"city":"New York","state":"NY","timezone":{"timezone_identifier":"America\/New_York","timezone_abbr":"EST","utc_offset_sec":-18000,"is_dst":"F"},"acceptable_city_names":[],"area_codes":[212,646,917]}

7 Replies to “generate python API testing code with postman”

  1. Your style is very unique in comparison to other folks I have read stuff from. Thanks for posting when you have the opportunity, Guess I will just bookmark this web site. Corrina Abel Erde

  2. I was curious if you ever thought of changing the structure of your site? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or two pictures. Maybe you could space it out better? Halli Rory Mirelle

Leave a Reply

Your email address will not be published. Required fields are marked *