Demo entry 6697567

test

   

Submitted by anonymous on Jan 24, 2018 at 17:48
Language: Python. Code size: 2.1 kB.

import requests
import time

cities = ["New York, NY","Los Angeles, CA","Chicago, IL","Brooklyn, NY","Queens, NY","Houston, TX","Manhattan, NY","Philadelphia, PA","Phoenix, AZ","San Antonio, TX","Bronx, NY","San Diego, CA","Dallas, TX","San Jose, CA","East San Gabriel Valley, CA","Austin, TX","Jacksonville, FL","San Francisco, CA","Indianapolis, IN","Columbus, OH","Fort Worth, TX","Charlotte, NC","Detroit, MI","El Paso, TX","Seattle, WA","Denver, CO","Washington, DC","Memphis, TN","Boston, MA","Nashville-Davidson, TN","Baltimore, MD","Metropolitan Government, TN","Oklahoma City, OK","Portland, OR","Las Vegas, NV","Milwaukee, WI","Albuquerque, NM","Tucson, AZ","Fresno, CA","East Seattle, WA","Central Contra Costa, CA","Sacramento, CA","Staten Island, NY","Long Beach, CA","Northeast Tarrant, TX","Kansas City, MO","Mesa, AZ","Northwest Harris, TX","Atlanta, GA","Northeast Jefferson, CO","Virginia Beach, VA","Omaha, NE","Colorado Springs, CO","Raleigh, NC","Miami, FL","Oakland, CA","Minneapolis, MN","Tulsa, OK","Cleveland, OH","Wichita, KS","New Orleans, LA","Arlington, TX","North Coast, CA","Honolulu, HI","Bakersfield, CA","Tampa, FL","Aurora, CO","Urban Honolulu, HI","Anaheim, CA","Kendale Lakes-Lindgren Acres, FL","Santa Ana, CA","South Aurora, CO","Upper San Gabriel Valley, CA","Southwest San Gabriel Valley, CA","Corpus Christi, TX","Riverside, CA","St. Louis, MO","Lexington-Fayette, KY","West Adams, CO","Pittsburgh, PA","Stockton, CA","Anchorage, AK","South Coast, CA","Cincinnati, OH","St. Paul, MN","Southeast Montgomery, TX","Fayette, KY","Greensboro, NC","Toledo, OH","Newark, NJ","Ewa, HI","Plano, TX","Henderson, NV","Lincoln, NE","Louisville, KY","Orlando, FL","Jersey City, NJ","Chula Vista, CA","Buffalo, NY","Fort Wayne, IN"]

url = "http://0.0.0.0:8080/data/"

def openUrl(url):
    try:
        r = requests.get(url, auth=('user','password'))
        data = r.json()
        return data
    except:
        return { 'error':'error'}  
    
for c in cities:
    time.sleep(1)
    new = url+c
    print(openUrl(new))

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).