[Change] bugFix checkUrl

master
Marcel Eggert 4 years ago
parent b207e31cfc
commit 27b89b4fe5
  1. 58
      main-azraelis.py

@ -701,30 +701,6 @@ def uploadPictureToGDrive(daten):
def checkBaseUrl(daten):
if not 'baseUrl' in daten['bannerInfos']:
daten['bannerInfos']['baseUrl'] = "Bitte Url nachtragen"
import pygsheets
gc = pygsheets.authorize(service_file='gdrive.json')
#open the google spreadsheet (where 'PY to Gsheet Test' is the name of my sheet)
sh = gc.open('Banner Liste')
#select the first sheet
wks = sh[0]
i = 1
cells = wks.get_all_values(include_tailing_empty_rows=False, include_tailing_empty=False, returnas='matrix')
not_in = True
banner_name = daten['bannerInfos']['filename'].split("_")
for cell in cells:
if banner_name[1] == cell[1]:
daten['bannerInfos']['baseUrl'] = cell[2]
break
if 'baseUrl' in daten['bannerInfos']:
import os
import pickle
@ -755,7 +731,7 @@ def checkBaseUrl(daten):
from pprint import pprint
# from init_photo_service import service
import pandas as pd
import time
"""
list method
@ -787,8 +763,9 @@ def checkBaseUrl(daten):
wks = sh[0]
i = 1
for item in lst_medias:
print(i)
print(f"{i}/{len(lst_medias)}")
cells = wks.get_all_values(include_tailing_empty_rows=False, include_tailing_empty=False, returnas='matrix')
not_in = True
@ -802,7 +779,34 @@ def checkBaseUrl(daten):
last_row = len(cells)
new_row = [ last_row, banner_name[1], item['baseUrl']]
worksheet = wks.insert_rows(last_row, values=new_row, inherit=True)
time.sleep(1)
i += 1
if not 'baseUrl' in daten['bannerInfos']:
daten['bannerInfos']['baseUrl'] = "Bitte Url nachtragen"
import pygsheets
gc = pygsheets.authorize(service_file='gdrive.json')
#open the google spreadsheet (where 'PY to Gsheet Test' is the name of my sheet)
sh = gc.open('Banner Liste')
#select the first sheet
wks = sh[0]
i = 1
cells = wks.get_all_values(include_tailing_empty_rows=False, include_tailing_empty=False, returnas='matrix')
not_in = True
banner_name = daten['bannerInfos']['filename'].split("_")
for cell in cells:
if banner_name[1] == cell[1]:
daten['bannerInfos']['baseUrl'] = cell[2]
break
return daten
def writeDataToGSheet(daten):

Loading…
Cancel
Save