from operator import length_hint
import requests

print("What would you like to search for?")
search = input("What would you like to search for?")
print("What page would you like to look on?")
num = input("What page would you like to look on?")

url = "https://steam2.p.rapidapi.com/search/" + search + "/page/" + num

headers = {
	"X-RapidAPI-Key": "88aa5b8dacmsh350e7e49edf633bp1971d7jsn1986942bb1b2",
	"X-RapidAPI-Host": "steam2.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers)

steam_data = response.json()

def print_data(d_rec):
	try:
		print(d_rec["imgUrl"])
	except:
		print("Error")
	try:
		print(d_rec["appId"], d_rec["title"], d_rec["price"], d_rec["released"], d_rec["reviewSummary"])
	except:
		try:
			print("(No appId)", d_rec["title"], d_rec["price"], d_rec["released"], d_rec["reviewSummary"])
		except:
			print("Error")
i = 0
def recursive_loop():
	global i
	if i < len(steam_data):
		record = steam_data[i]
		print_data(record)
		i += 1
		recursive_loop()

recursive_loop()
#print(response.text)
What would you like to search for?
What page would you like to look on?
https://cdn.akamai.steamstatic.com/steam/apps/105600/capsule_sm_120.jpg?t=1664397885
105600 Terraria                         9,99€                     16 May, 2011 Overwhelmingly Positive<br>97% of the 810,532 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/409210/capsule_sm_120.jpg?t=1602690120
409210 Terraria: Official Soundtrack                         3,99€                     13 Oct, 2015 Very Positive<br>95% of the 468 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/1323320/capsule_sm_120.jpg?t=1594220078
1323320 Terraria: Otherworld Official Soundtrack                         3,99€                     25 Jun, 2020 Very Positive<br>96% of the 153 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/322330/capsule_sm_120.jpg?t=1659633087
322330 Don't Starve Together                         14,99€                     21 Apr, 2016 Overwhelmingly Positive<br>96% of the 232,472 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/304050/capsule_sm_120.jpg?t=1657799658
304050 Trove                                              9 Jul, 2015 Very Positive<br>80% of the 88,003 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/219740/capsule_sm_120.jpg?t=1647292111
219740 Don't Starve                         8,19€                      Overwhelmingly Positive<br>96% of the 81,932 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/751780/capsule_sm_120.jpg?t=1659134729
751780 Forager                         19,99€                     18 Apr, 2019 Very Positive<br>91% of the 25,726 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/1072420/capsule_sm_120.jpg?t=1661972322
1072420 DRAGON QUEST BUILDERS™ 2                         49,99€                     10 Dec, 2019 Very Positive<br>92% of the 4,669 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/248390/capsule_sm_120.jpg?t=1637833319
248390 Craft The World                         18,99€                     24 Nov, 2014 Very Positive<br>88% of the 11,574 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/712640/capsule_sm_120.jpg?t=1598399015
712640 Don't Starve: Hamlet                         5,69€                     8 Nov, 2018 Very Positive<br>86% of the 1,353 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/1710240/capsule_sm_120.jpg?t=1631204890
1710240 Don't Starve Together: Starter Pack 2021                         6,59€                     9 Sep, 2021 Very Positive<br>86% of the 65 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/1281930/capsule_sm_120.jpg?t=1654800634
1281930 tModLoader                         Free                     16 May, 2020 Overwhelmingly Positive<br>97% of the 148,124 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/393010/capsule_sm_120.jpg?t=1596173066
393010 Don't Starve: Shipwrecked                         4,99€                     1 Dec, 2015 Overwhelmingly Positive<br>95% of the 3,009 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/282470/capsule_sm_120.jpg?t=1585716887
282470 Don't Starve: Reign of Giants                         4,99€                     2 Apr, 2014 Overwhelmingly Positive<br>96% of the 1,488 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/bundles/21303/dngzv4s9lxvyibvx/capsule_sm_120.jpg?t=1623045187
(No appId) Ultimate Craft Bundle                         39,30€                      Very Positive<br>87% of the 12,254 user reviews for games in this bundle are positive.
https://cdn.akamai.steamstatic.com/steam/apps/280790/capsule_sm_120.jpg?t=1637786796
280790 Creativerse                         Free To Play                     8 May, 2017 Very Positive<br>80% of the 29,693 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/265000/capsule_sm_120.jpg?t=1560428692
265000 FORCED SHOWDOWN                         19,99€                     29 Mar, 2016 Very Positive<br>83% of the 472 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/391730/capsule_sm_120.jpg?t=1659108826
391730 Crashlands                         14,99€                     21 Jan, 2016 Very Positive<br>89% of the 2,938 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/636040/capsule_sm_120.jpg?t=1607517047
636040 Pixel Worlds: MMO Sandbox                         Free To Play                     8 Jun, 2017 Mostly Positive<br>74% of the 5,140 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/705120/capsule_sm_120.jpg?t=1641371368
705120 Death Coming/死神来了                         6,99€                     6 Nov, 2017 Very Positive<br>90% of the 2,937 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/385380/capsule_sm_120.jpg?t=1656016201
385380 Planet Centauri                         13,99€                     3 Jun, 2016 Very Positive<br>80% of the 1,585 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/315460/capsule_sm_120.jpg?t=1626875302
315460 Dig or Die                         11,99€                     10 Jul, 2018 Very Positive<br>90% of the 3,521 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/1509120/capsule_sm_120.jpg?t=1612934974
1509120 Craft The World - Heart of Evil                         5,69€                     27 Dec, 2020 Mixed<br>40% of the 52 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/1105370/capsule_sm_120.jpg?t=1604663915
1105370 Craft The World - Bosses & Monsters                         6,59€                     25 Jun, 2019 Mixed<br>57% of the 118 user reviews for this game are positive.
https://cdn.akamai.steamstatic.com/steam/apps/852500/capsule_sm_120.jpg?t=1525129173
852500 WorldQuest                         Free                     29 Apr, 2018 Mixed<br>68% of the 83 user reviews for this game are positive.
"""
Requests is a HTTP library for the Python programming language. 
The goal of the project is to make HTTP requests simpler and more human-friendly. 
"""
import requests

"""
RapidAPI is the world's largest API Marketplace. 
Developers use Rapid API to discover and connect to thousands of APIs. 
"""
url = "https://corona-virus-world-and-india-data.p.rapidapi.com/api"
headers = {
    'x-rapidapi-key': "dec069b877msh0d9d0827664078cp1a18fajsn2afac35ae063",
    'x-rapidapi-host': "corona-virus-world-and-india-data.p.rapidapi.com"
}

# Request Covid Data
response = requests.request("GET", url, headers=headers)
# print(response.text)  # uncomment this line to see raw data

# This code looks for "world data"
print("World Totals")
world = response.json().get('world_total')  # turn response to json() so we can extract "world_total"
for key, value in world.items():  # this finds key, value pairs in country
    print(key, value)

print()

# This code looks for USA in "countries_stats"
print("Country Totals")
countries = response.json().get('countries_stat')
for country in countries:  # countries is a list
    if country["country_name"] == "USA":  # this filters for USA
        for key, value in country.items():  # this finds key, value pairs in country
            print(key, value)
World Totals
total_cases 509,268,964
new_cases 204,268
total_deaths 6,242,509
new_deaths 630
total_recovered 461,827,849
active_cases 41,198,606
serious_critical 42,510
total_cases_per_1m_population 65,334
deaths_per_1m_population 800.9
statistic_taken_at 2022-04-24 11:18:01

Country Totals
country_name USA
cases 82,649,779
deaths 1,018,316
region 
total_recovered 80,434,925
new_deaths 0
new_cases 0
serious_critical 1,465
active_cases 1,196,538
total_cases_per_1m_population 247,080
deaths_per_1m_population 3,044
total_tests 1,000,275,726
tests_per_1m_population 2,990,303
# Begin Rapid API Code
import requests

url = "https://coinranking1.p.rapidapi.com/coins"
querystring = {"referenceCurrencyUuid":"yhjMzLPhuIDl","timePeriod":"24h","tiers[0]":"1","orderBy":"marketCap","orderDirection":"desc","limit":"50","offset":"0"}
headers = {
	"X-RapidAPI-Key": "jcmbea0fa2ff5msh7f14bf69be38ca6p175482jsn6c4988114560",  # place your key here
	"X-RapidAPI-Host": "coinranking1.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
# End Rapid API Code
json = response.json()  # convert response to python json object

# Observe data from an API.  This is how data transports over the internet in a "JSON" text form
# - The JSON "text" is formed in dictionary {} and list [] divisions
# - To read the result, Data Scientist of  Developer converts JSON into human readable form
# - Review the first line, look for the keys --  "status" and "data"
{"message":"You are not subscribed to this API."}