Alp57 commited on
Commit
3508c55
·
verified ·
1 Parent(s): f6f3b61

Upload 2 files

Browse files
Files changed (2) hide show
  1. src/api_logic.py +24 -24
  2. src/google-ads.yaml +6 -0
src/api_logic.py CHANGED
@@ -4,30 +4,30 @@ from google.ads.googleads.client import GoogleAdsClient
4
  from google.ads.googleads.errors import GoogleAdsException
5
  import os
6
 
7
- # Read yaml from Secrets in HF
8
- yaml_str = os.environ["GOOGLE_ADS_YAML"]
9
- # Write YAML to a temporary file
10
- with open("google-ads.yaml", "w") as f:
11
- f.write(yaml_str)
12
-
13
- # ADD
14
- import yaml
15
-
16
- print("=== GOOGLE_ADS_YAML Exists? ===", "GOOGLE_ADS_YAML" in os.environ)
17
- print("=== YAML Content Preview ===")
18
- print(yaml_str[:300])
19
- print("================================")
20
-
21
- # --- Validate YAML Format ---
22
- try:
23
- parsed = yaml.safe_load(yaml_str)
24
- print("YAML parsed OK:", type(parsed))
25
- except Exception as e:
26
- print("YAML parse error:", e)
27
-
28
- # --- Write YAML to file ---
29
- with open("google-ads.yaml", "w", encoding="utf-8") as f:
30
- f.write(yaml_str)#
31
 
32
 
33
  client = GoogleAdsClient.load_from_storage("google-ads.yaml")
 
4
  from google.ads.googleads.errors import GoogleAdsException
5
  import os
6
 
7
+ # # Read yaml from Secrets in HF
8
+ # yaml_str = os.environ["GOOGLE_ADS_YAML"]
9
+ # # Write YAML to a temporary file
10
+ # with open("google-ads.yaml", "w") as f:
11
+ # f.write(yaml_str)
12
+
13
+ # # ADD
14
+ # import yaml
15
+
16
+ # print("=== GOOGLE_ADS_YAML Exists? ===", "GOOGLE_ADS_YAML" in os.environ)
17
+ # print("=== YAML Content Preview ===")
18
+ # print(yaml_str[:300])
19
+ # print("================================")
20
+
21
+ # # --- Validate YAML Format ---
22
+ # try:
23
+ # parsed = yaml.safe_load(yaml_str)
24
+ # print("YAML parsed OK:", type(parsed))
25
+ # except Exception as e:
26
+ # print("YAML parse error:", e)
27
+
28
+ # # --- Write YAML to file ---
29
+ # with open("google-ads.yaml", "w", encoding="utf-8") as f:
30
+ # f.write(yaml_str)#
31
 
32
 
33
  client = GoogleAdsClient.load_from_storage("google-ads.yaml")
src/google-ads.yaml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+
2
+ developer_token: "QdwWYJeOmOT5uvdGWY53kw"
3
+ client_id: "268269467395-14rt4cpvl5i9vaa7k26hbgdtdpfdanrs.apps.googleusercontent.com"
4
+ client_secret: "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"
5
+ refresh_token: "1//09nDiqNZQTZI5CgYIARAAGAkSNwF-L9IrUVowaxSVigKLP7Me8xP6UMQamYF798atc0C1__pj061HvUy5BpnrdKXqp0e3pI_hLk4"
6
+ use_proto_plus: True