Power-supply circuit operates from USB port article mentions some useful points on using USB connector as power source as well as gives an useful circuit diagram.
You can use a USB port to power an external circuit. Even one without any USB functionality in it. Every PC has a USB (Universal Serial Bus) port that can supply 5V±5% at 500 mA for peripherals. Powered USB hubs also provide this power. The USB standard allows a host to supply as little as 100 mA until the device enumerates. This design assumes that it is powering a device that does not actually talk on the bus so can’t enumerate. To be compliant to the standard, don’t count on using more than 100 mA if you are not actually talking on the bus.
A host may allow a device that doesn’t enumerate to draw more than 100 mA, but it may not. The Windows hosts that I have tested seem to allow more than 100 mA at all times and never refuse an enumeration request to go to high power, but your luck may vary on some laptops and non-PC devices.