Skip to content

Instantly share code, notes, and snippets.

@tiomoreno
Created November 24, 2020 22:24
Show Gist options
  • Save tiomoreno/e000167a9a9762b455ecd21f46025f15 to your computer and use it in GitHub Desktop.
Save tiomoreno/e000167a9a9762b455ecd21f46025f15 to your computer and use it in GitHub Desktop.
main.py
# Trazer um uuid do httpbin com uma mensagem padrão.
# Caso de sucesso:
# Deve retornar "New uuid generated by httpbin: 04ea103d-bf5a-4b6b-be92-ba53538b1815"
# Restrições trazer o uuid de uma resposta do httpbin
# Caso o httpbin responda com 404 então deve retornar uma mensagem de erro:
# HTTPBin Request Error
# Caso o httpbin responda com error de servidor ou seja entre 500 e 599
# HTTPBin Server Error
import requests
from google_play_scraper import app
def httpbin_requester():
resp = requests.get("https://httpbin.org/uuid")
if resp.status_code == 200:
uuid_data = resp.json()
return f"New uuid generated by httpbin: {uuid_data['uuid']}"
if resp.status_code >= 500 and resp.status_code < 600:
return "HTTPBin Server Error"
return "HTTPBin Request Error"
def fetch_google_play_installs(appid):
play_data = app(appid, lang="pt-br", country="br")
return play_data["installs"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment