-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppStoreGoogleInternal.py
More file actions
194 lines (145 loc) · 6.49 KB
/
Copy pathAppStoreGoogleInternal.py
File metadata and controls
194 lines (145 loc) · 6.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# 导入selenium的浏览器驱动接口
import sys
import os
import json
o_path = os.getcwd() # 返回当前工作目录
sys.path.append(o_path) # 添加自己指定的搜索路径
import AppInfo
import sqlite3
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from Common import Source
from AppStore.AppStoreBase import AppStoreBase
from AppStore.GooglePlayApi import mainGooglePlayApi
from AppInfo.AppInfo import mainAppInfo
from Project.Resource import mainResource
from Common.WebDriver.WebDriverCmd import CmdType
from Common.WebDriver.WebDriverCmd import WebDriverCmd
from Common.WebDriver.WebDriverCmd import CmdInfo
# 要想调用键盘按键操作需要引入keys包
# 导入chrome选项
# pip3 install pywin32
# sys.path.append('../common')
class AppStoreGoogleInternal(AppStoreBase):
listCountry = ["zh-CN","en-US", "en-ZA","en-SG","en-IN","en-CA","en-AU","en-GB"]
listCountryLanguage = ["cn","en", "en","en","en", "en","en","en"]
# listCountry = ["en-AU","en-GB"]
# listCountryLanguage = ["en","en"]
# https://developers.google.cn/android-publisher/api-ref/rest/v3/AppImageType?hl=zh-cn tvBanner
# phoneScreenshots
# listDisplay = ["PHONE_SCREENSHOTS", "SEVEN_INCH_SCREENSHOTS","TEN_INCH_SCREENSHOTS","ICON","FEATURE_GRAPHIC"]
listDisplay = ["phoneScreenshots", "sevenInchScreenshots","tenInchScreenshots","icon","featureGraphic"]
listDisplayName = ["iphone_6_5", "iphone","ipadpro","icon","adhome"]
apptype = ""
appkey = ""
def GoHome(self,isHD):
# appid = AppInfo.GetAppId(isHD, source.APPSTORE)
url = "https://play.google.com/apps/publish/?account=5674304593297259399#ApiAccessPlace"
# url ="https://appstoreconnect.apple.com/apps/"+appid+"/appstore/ios/version/deliverable"
print(url)
self.driver.get(url)
time.sleep(1)
self.Login("chyfemail163@gmail.com", "qianlizhiwai1")
def Login(self,user,password):
self.urlold = self.driver.current_url
print("Login urlold=",self.urlold)
webcmd = WebDriverCmd(self.driver)
# 等待网页加载成功
key = "//input[@type='email']"
item = webcmd.Find(key,True)
webcmd.AddCmd(CmdType.INPUT,key,user)
webcmd.Run(True)
key = "//span[contains(text(),'下一步')]"
webcmd.AddCmd(CmdType.CLICK_Action,key)
webcmd.Run(True)
time.sleep(1)
# 等待登录成功
while True:
time.sleep(1)
self.urlnew = self.driver.current_url
print("Login urlnew=",self.urlnew)
if self.urlnew!=self.urlold:
print("Login Finish =",self.urlnew)
break
# 3452644866 qq31415926
def CreateApp(self, isHD):
# ad.GoHome(isHD)
time.sleep(1)
print(" gp CreateApp")
# https://developers.google.cn/android-publisher/api-ref/rest/v3/AppImageType?hl=zh-cn
def UploadScreenShot(self,isHD):
# isHD = True
package = mainAppInfo.GetAppPackage(Source.ANDROID,isHD,Source.GP)
version = mainAppInfo.GetAppVersion(Source.ANDROID,isHD)
total_screenshot = 5
idx_country =0
idx_display =0
for country in self.listCountry:
idx_display = 0
for type in self.listDisplay:
for i in range(total_screenshot):
applan = self.listCountryLanguage[idx_country]
filepath = mainResource.GetOutPutScreenshot(isHD)+"/"+applan+"/"+self.listDisplayName[idx_display]+"/"+str(i+1)+".jpg"
if self.listDisplayName[idx_display]=="icon":
filepath = mainResource.GetOutPutIconPathWin32( mainResource.GetProjectOutPut(), Source.TAPTAP, isHD)+"\\icon_android_512.png"
if i>0:
continue
if self.listDisplayName[idx_display]=="adhome":
filepath = mainResource.GetOutPutAdPathWin32(mainResource.GetProjectOutPut(), Source.TAPTAP, isHD) + "\\"+applan+"\\"+"ad_home_1024x500.png"
if i>0:
continue
print("UploadScreenShot filepath=",filepath)
if os.path.exists(filepath):
mainGooglePlayApi.DeleteAllScreenShot(package, version, country, type)
mainGooglePlayApi.UploadOneScreenShot(package, filepath, country, type)
idx_display+=1
idx_country+=1
def UpdateAppInfo(self,isHD):
package = mainAppInfo.GetAppPackage(Source.ANDROID,isHD,Source.GP)
version = mainAppInfo.GetAppVersion(Source.ANDROID,isHD)
idx = 0
print("google UpdateAppInfo=",package)
for country in self.listCountry:
lan = self.listCountryLanguage[idx]
name= mainAppInfo.GetAppName(Source.IOS, isHD,lan,Source.GP)
description = mainAppInfo.GetAppDetail(isHD,lan)
promotionalText = mainAppInfo.GetAppPromotion(isHD, lan)
mainGooglePlayApi.UpdateAppInfo(package,country,name,description,promotionalText,str(isHD),lan)
idx+=1
def UpdateApk(self,isHD):
package = mainAppInfo.GetAppPackage(Source.ANDROID,isHD,Source.GP)
apk = mainResource.GetOutPutApkPath(Source.GP, isHD)
mainGooglePlayApi.UploadApk(package,apk)
def Run(self,type, isHD):
if type == "createapp":
self.Init()
self.GoHome(isHD)
self.CreateApp(isHD)
time.sleep(3)
# ad.CreateApp(True)
if type == "UploadScreenShot":
if isHD:
self.UploadScreenShot(True)
else:
self.UploadScreenShot(False)
time.sleep(3)
# ad.UpdateApp(True)
if type == "UpdateAppInfo":
if isHD:
self.UpdateAppInfo(True)
else:
self.UpdateAppInfo(False)
time.sleep(3)
# ad.UpdateApp(True)
if type == "UpdateApk":
if isHD:
self.UpdateApk(True)
else:
self.UpdateApk(False)
time.sleep(3)
# ad.UpdateApp(True)
# ad.Quit(300)
mainAppStoreGoogleInternal = AppStoreGoogleInternal()