40 lines
1003 B
Python
40 lines
1003 B
Python
import os
|
|
import requests
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
def inspect_enums():
|
|
token = os.getenv("BUFFER_ACCESS_TOKEN")
|
|
url = "https://api.buffer.com/graphql"
|
|
headers = {
|
|
"Authorization": f"Bearer {token}",
|
|
"Content-Type": "application/json"
|
|
}
|
|
|
|
query = """
|
|
query {
|
|
sched: __type(name: "SchedulingType") {
|
|
enumValues { name }
|
|
}
|
|
mode: __type(name: "ShareMode") {
|
|
enumValues { name }
|
|
}
|
|
}
|
|
"""
|
|
|
|
response = requests.post(url, headers=headers, json={'query': query})
|
|
if response.status_code == 200:
|
|
data = response.json()
|
|
print("\n--- VALORI SCHEDULING ---")
|
|
for v in data['data']['sched']['enumValues']:
|
|
print(v['name'])
|
|
print("\n--- VALORI SHARE MODE ---")
|
|
for v in data['data']['mode']['enumValues']:
|
|
print(v['name'])
|
|
else:
|
|
print(f"Errore {response.status_code}")
|
|
|
|
if __name__ == "__main__":
|
|
inspect_enums()
|