Shreyas094 commited on
Commit
9fcd7e5
·
verified ·
1 Parent(s): 015d1f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -1,4 +1,9 @@
1
  import requests
 
 
 
 
 
2
 
3
  # Replace with your actual Cloudflare API token
4
  API_TOKEN = os.environ.get("CLOUDFLARE_AUTH_TOKEN")
@@ -29,3 +34,13 @@ if response.status_code == 200:
29
  print("Error fetching account details:", data['errors'])
30
  else:
31
  print("Failed to fetch account details. HTTP Status Code:", response.status_code)
 
 
 
 
 
 
 
 
 
 
 
1
  import requests
2
+ import os
3
+ from dotenv import load_dotenv
4
+
5
+ # Load environment variables from .env file
6
+ load_dotenv()
7
 
8
  # Replace with your actual Cloudflare API token
9
  API_TOKEN = os.environ.get("CLOUDFLARE_AUTH_TOKEN")
 
34
  print("Error fetching account details:", data['errors'])
35
  else:
36
  print("Failed to fetch account details. HTTP Status Code:", response.status_code)
37
+
38
+ # Creating a Gradio interface
39
+ iface = gr.Interface(fn=get_cloudflare_accounts,
40
+ inputs=None,
41
+ outputs="text",
42
+ title="Cloudflare Account Details",
43
+ description="Fetch and display Cloudflare account details using the API.")
44
+
45
+ # Launch the interface
46
+ iface.launch()