initBasti / Amazon2PlentySync (public) (License: GPLv3) (since 2019-01-27) (hash sha1)
Transfer your data from you Amazon Flatfile spreadsheet over to the Plentymarkets system. How to is included in the readme
List of commits:
Subject Hash Author Date (UTC)
Added category_config functionality 7bd8256398b4af5c1feb3033d74cd9f29b047edc Sebastian Fricke 2020-01-15 14:53:20
improved error handling & adjusted names to naming convention cfcd91090a2598c6c51576bcdd53e03ab6c2f59b Sebastian Fricke 2020-01-15 14:47:42
Refactor CategoryChooser 562e6657c6fef89d0584731e54325cec013268a7 Sebastian Fricke 2020-01-15 14:42:11
Add category_config location to the script config 8698e4a99d63b06fde5c39787fc7d6f7400b9f47 Sebastian Fricke 2020-01-15 14:29:47
Refactor findConfig 321ae9d7edd69e8be0755cf5ba82289944d06ca3 Sebastian Fricke 2020-01-15 14:26:09
Add logging function: no category config warning e8323843a3b6c24ef274d6a12c10d76aa8b8f591 Sebastian Fricke 2020-01-14 14:38:39
Add module + test for the category-id config fadaf4515aab1009f4df4a1af5a2e8f82077bc4c Sebastian Fricke 2020-01-14 14:35:44
improved coding style on log functions caf97eec6c6026aa051bc98f02a90e649a6e4754 Sebastian Fricke 2020-01-14 10:23:17
fixed a typo in the product type list 707e993b953aea0d653ffbca136bbe81bb36ea13 Sebastian Fricke 2020-01-14 10:22:34
added home product properties, improved dictionary iteration, fixed a key error in get_attributes 30d4aed4403c39a6865e30c0384c3360d375cbb6 Sebastian Fricke 2020-01-14 10:21:56
removed warning for missing flatfile columns as requested bfe6e22f7acb282a3af8423c81ceacf9fcf21ef4 Sebastian Fricke 2020-01-13 15:05:27
added initialization for the position variable 8331f92d62deb9ba7be7e97201c7c6afa7cf732a Sebastian Fricke 2020-01-13 14:47:57
improved code style and fixed problem where the dictionary containing the path was given to functions instead of the path itself 1a5bf99751b599f48d4687a9a6cbd55ffe213f5a Sebastian Fricke 2020-01-13 14:47:13
removed Barcode missing warning on parents b592779c6cc1588e2ae40394cab53d0d047746e7 Sebastian Fricke 2020-01-13 14:46:16
Added support for the amazon product types furnitureanddecor, bedandbath, swimwear b56708e55c3283a6cc2d3803b2abbb99bb125928 Sebastian Fricke 2020-01-13 14:16:40
fix failing attribute sync 87ea4bce17eba6c9c9842eaf9eb26249bf8d7da5 Sebastian Fricke 2020-01-13 12:15:35
new config handling d65bdfae89eceab6b1319d01373cf70ac7d8b63e Sebastian Fricke 2019-11-13 08:57:14
Fixed a problem, that caused Data to not pass sorting; Fixed error handling with the product type; Updated category ids 9a62d369fb24bc80765cd19e31fb255398fb8ed5 Sebastian Fricke 2019-09-12 09:27:54
fixed a merge conflict bug e6b4d9613237009d980cdbfc7ec65c3383a3495a Sebastian Fricke 2019-08-16 11:31:02
current status 15.8 94db3a5c98c596b24f00624fa4b772b9fd830b03 Sebastian Fricke 2019-08-15 14:26:42
Commit 7bd8256398b4af5c1feb3033d74cd9f29b047edc - Added category_config functionality
Author: Sebastian Fricke
Author date (UTC): 2020-01-15 14:53
Committer name: Sebastian Fricke
Committer date (UTC): 2020-01-15 14:53
Parent(s): cfcd91090a2598c6c51576bcdd53e03ab6c2f59b
Signer:
Signing key:
Signing status: N
Tree: 1bab748a533674f4c5a9134343c229e659eadbd8
File Lines added Lines deleted
product_import.py 40 19
File product_import.py changed (mode: 100644) (index d5ccd2c..27a527d)
... ... import platform
5 5 import os import os
6 6 import time import time
7 7 import ntpath import ntpath
8 from packages.item_upload import itemUpload, WrongEncodingException, check_encoding, check_flatfile, itemPropertyUpload
8 from packages.item_upload import itemUpload, WrongEncodingException, checkEncoding, checkFlatfile, itemPropertyUpload
9 9 from packages.barcode import EmptyFieldWarning from packages.barcode import EmptyFieldWarning
10 10 from packages.amazon_data_upload import featureUpload from packages.amazon_data_upload import featureUpload
11 11 from packages.log_files import fileNotFoundLog, keyErrorLog, wrongEncodingLog, unboundLocalLog, emptyFieldWarningLog from packages.log_files import fileNotFoundLog, keyErrorLog, wrongEncodingLog, unboundLocalLog, emptyFieldWarningLog
12 12 from packages.gui.category_chooser import CategoryChooser from packages.gui.category_chooser import CategoryChooser
13 13 from packages.config import config_creation, config_read, config_write from packages.config import config_creation, config_read, config_write
14 14 from packages.image_upload import imageUpload from packages.image_upload import imageUpload
15 from packages.category import CategoryConfig
15 16
16 17
17 18 def main(): def main():
 
... ... def main():
22 23 recent_path = '' recent_path = ''
23 24 config_path = '' config_path = ''
24 25 attribute_date = '' attribute_date = ''
26 config = dict()
25 27 sheet = {'path':'', 'encoding':''} sheet = {'path':'', 'encoding':''}
26 28 intern_number = {'path':'', 'encoding':''} intern_number = {'path':'', 'encoding':''}
27 29 stocklist = {'path':'', 'encoding':''} stocklist = {'path':'', 'encoding':''}
 
... ... def main():
29 31 attributefile = {'path':'', 'encoding':''} attributefile = {'path':'', 'encoding':''}
30 32 step = int(0) step = int(0)
31 33 fexc = '' fexc = ''
34
35 cat_conf = CategoryConfig()
36
32 37 # Create a list of step names where every name fits to the index of a step number # Create a list of step names where every name fits to the index of a step number
33 38 step_name = ['environment-creation', step_name = ['environment-creation',
34 39 'config-creation', 'config-creation',
35 40 'config-reading', 'config-reading',
41 'category-config',
36 42 'import-flatfile', 'import-flatfile',
37 43 'GUI', 'GUI',
38 44 'import-internlist', 'import-internlist',
 
... ... def main():
77 83 step += 1; step += 1;
78 84 # CONFIG READING # CONFIG READING
79 85 # Get the Upload and data folder from the config if possible # Get the Upload and data folder from the config if possible
80 if(config_read(config_path)['upload_folder']):
81 upload_folder = config_read(config_path)['upload_folder']
82 if(config_read(config_path)['data_folder']):
83 recent_path = config_read(config_path)['data_folder']
84 if(config_read(config_path)['attribute_file']):
85 attributefile['path'] = config_read(config_path)['attribute_file']
86 attributefile = check_encoding(attributefile)
87 if(config_read(config_path)['file_change_date']):
88 attribute_date = config_read(config_path)['file_change_date']
86 config = config_read(config_path)
87 if(config['upload_folder']):
88 upload_folder = config['upload_folder']
89 if(config['data_folder']):
90 recent_path = config['data_folder']
91 if(config['attribute_file']):
92 attributefile['path'] = config['attribute_file']
93 attributefile = checkEncoding(attributefile)
94 if(config['file_change_date']):
95 attribute_date = config['file_change_date']
96 if(config['category_config']):
97 cat_conf.path['path'] = config['category_config']
98 cat_conf.path = checkEncoding(cat_conf.path)
99
100 # Category Config
101 if(not(cat_conf.path['path'])):
102 if(not(cat_conf.findConfig(os.path.dirname(
103 os.path.abspath(__file__))))):
104 print('no category config found\n')
105 print('Press Enter to continue...')
106 input()
107 sys.exit()
108 cat_conf.readConfig()
109
89 110 if(not(recent_path)): if(not(recent_path)):
90 111 recent_path = tkinter.filedialog.askdirectory(initialdir=initial_directory, recent_path = tkinter.filedialog.askdirectory(initialdir=initial_directory,
91 112 title="Choose a folder from where to upload") title="Choose a folder from where to upload")
 
... ... def main():
96 117 attributefile['path'] = askopenfilename(initialdir=recent_path, attributefile['path'] = askopenfilename(initialdir=recent_path,
97 118 title="Color Attributes from PlentyMarkets", title="Color Attributes from PlentyMarkets",
98 119 filetypes=[ ("csv files", "*.csv") ]) filetypes=[ ("csv files", "*.csv") ])
99 attributefile = check_encoding(attributefile)
120 attributefile = checkEncoding(attributefile)
100 121
101 122 # Import Flatfile # Import Flatfile
102 123 step += 1 step += 1
 
... ... def main():
104 125 title="Amazon Flatfile as .csv", title="Amazon Flatfile as .csv",
105 126 filetypes=[ ("csv files", "*.csv") ]) filetypes=[ ("csv files", "*.csv") ])
106 127
107 sheet = check_encoding(sheet)
128 sheet = checkEncoding(sheet)
108 129
109 130 # Check if the file was loaded properly and got the correct format # Check if the file was loaded properly and got the correct format
110 131 try: try:
111 if(not( check_flatfile(sheet) )):
132 if(not( checkFlatfile(sheet) )):
112 133 print('Please fix the flatfile and try again.\n') print('Please fix the flatfile and try again.\n')
113 134 print('Press Enter to continue...') print('Press Enter to continue...')
114 135 input() input()
 
... ... def main():
122 143 step += 1; step += 1;
123 144 # GUI # GUI
124 145 # Ask the user for input inside a gui asking for categories and name # Ask the user for input inside a gui asking for categories and name
125 cchooser = CategoryChooser(None, upload_folder, sheet, attributefile, attribute_date)
146 cchooser = CategoryChooser(None, cat_conf.id_list, upload_folder, sheet, attributefile,
147 attribute_date)
126 148 cchooser.title("Choose the category and name") cchooser.title("Choose the category and name")
127 149 LOOP_ACTIVE = True LOOP_ACTIVE = True
128 150 while (LOOP_ACTIVE): while (LOOP_ACTIVE):
129 151 if(cchooser): if(cchooser):
130 152 cchooser.update() cchooser.update()
131 time.sleep(0.3)
153 time.sleep(0.1)
132 154 if(cchooser.data['name'] and cchooser.data['categories'] and\ if(cchooser.data['name'] and cchooser.data['categories'] and\
133 155 cchooser.data['marking']): cchooser.data['marking']):
134 156 LOOP_ACTIVE = False LOOP_ACTIVE = False
 
... ... def main():
175 197
176 198 if(user_data): if(user_data):
177 199 # Check if there is already a log folder within the upload folder # Check if there is already a log folder within the upload folder
178 print(upload_folder)
179 200 if( not(os.path.exists(os.path.join(upload_folder, 'log'))) ): if( not(os.path.exists(os.path.join(upload_folder, 'log'))) ):
180 201 log_folder = os.path.join(upload_folder, 'log') log_folder = os.path.join(upload_folder, 'log')
181 202 os.makedirs(log_folder) os.makedirs(log_folder)
 
... ... def main():
187 208 title="The Intern Numbers as .csv", title="The Intern Numbers as .csv",
188 209 filetypes=[ ("csv files", "*.csv") ]) filetypes=[ ("csv files", "*.csv") ])
189 210
190 intern_number = check_encoding(intern_number)
211 intern_number = checkEncoding(intern_number)
191 212
192 213 step += 1; step += 1;
193 214 try: try:
 
... ... def main():
195 216 title="The Stockreport from Amazon as .csv", title="The Stockreport from Amazon as .csv",
196 217 filetypes=[ ("csv files", "*.csv") ]) filetypes=[ ("csv files", "*.csv") ])
197 218
198 stocklist = check_encoding(stocklist)
219 stocklist = checkEncoding(stocklist)
199 220 except OSError as fexc: except OSError as fexc:
200 221 fileNotFoundLog( fileNotFoundLog(
201 222 log_path=log_folder, step_number=step, log_path=log_folder, step_number=step,
 
... ... def main():
295 316 title="Export File from Plentymarkets", title="Export File from Plentymarkets",
296 317 filetypes=[ ("csv files", "*.csv") ]) filetypes=[ ("csv files", "*.csv") ])
297 318
298 plenty_export = check_encoding(plenty_export)
319 plenty_export = checkEncoding(plenty_export)
299 320
300 321 step += 1 step += 1
301 322 imageUpload(flatfile=sheet, imageUpload(flatfile=sheet,
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/initBasti/Amazon2PlentySync

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/initBasti/Amazon2PlentySync

Clone this repository using git:
git clone git://git.rocketgit.com/user/initBasti/Amazon2PlentySync

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main