Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Web connection delay
#6
By the way, you can use the find method on an Element.

root = ET.fromstring(r.content)
TZ = resp.find('TimeZone').text
Another trick to make from a flat xml structure a dict:
result = {e.tag: e.text for e in resp}
Output:
{'Ip': 'xxx.xxx.xxx.xxx', 'Status': 'OK', 'CountryCode': 'DE', 'CountryCode3': 'DEU', 'CountryName': 'Germany', 'RegionCode': '07', 'RegionName': 'Nordrhein-Westfalen', 'City': 'Iserlohn', 'ZipPostalCode': '58636', 'Latitude': '51.3800', 'Longitude': '7.7032', 'AreaCode': '0', 'TimeZone': 'Europe/Berlin'}
You should not run your script to often. Otherwise -> RateLimit
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
Web connection delay - by ebolisa - Mar-31-2019, 08:49 PM
RE: Web connection delay - by micseydel - Apr-02-2019, 06:10 PM
RE: Web connection delay - by aishyoung056 - Apr-22-2019, 04:33 PM
RE: Web connection delay - by Larz60+ - Apr-22-2019, 08:55 PM
RE: Web connection delay - by micseydel - Apr-23-2019, 12:31 AM
RE: Web connection delay - by DeaD_EyE - Apr-23-2019, 11:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Scraping with some delay Truman 3 3,141 Jun-10-2019, 12:00 AM
Last Post: metulburr
  http.server start delay pastacolsugo 1 3,084 Apr-18-2018, 08:58 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020