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)
code cleanup and coding style category.py b1e41b45fe405d3826a9b6e452fb9e2f9f6697bf Sebastian Fricke 2020-01-16 10:43:44
Added the category config to the gitignore file b8b522d9ade4b59b5d0a0bd4f9b7c79e8db334c6 Sebastian Fricke 2020-01-15 14:56:06
Removed log function for category_config(not needed) c8ca8a3b6b968f1835697073e7d5fe1ea70b15ba Sebastian Fricke 2020-01-15 14:54:15
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
Commit b1e41b45fe405d3826a9b6e452fb9e2f9f6697bf - code cleanup and coding style category.py
improved the documentation of the class and it's methods
coding style clean up after pep8 conventition
inclusion of the warnPrint and errorPrint functions to highlight errors
Author: Sebastian Fricke
Author date (UTC): 2020-01-16 10:43
Committer name: Sebastian Fricke
Committer date (UTC): 2020-01-16 10:43
Parent(s): 4f99642503ec8f999379f9dc98d9ecaaf2abb173
Signer:
Signing key:
Signing status: N
Tree: 2c38b6d71c6f55caacf57c865f35108a04f8aba4
File Lines added Lines deleted
packages/category.py 72 32
File packages/category.py changed (mode: 100644) (index e6bc0ec..a0c460f)
1 from packages.item_upload import checkEncoding
2 from packages.config import get_path
1 """
2 written by: Sebastian Fricke
3 2019-01-15
4
5 class and functions for handling the category config
6
7 CategoryConfig class:
8 contains the final dictionary id_list
9 the raw_data list for the initial read
10 and the path object with path string and encoding
11 """
12
3 13 import os import os
4 from pathlib import Path
14 import sys
15 from packages.item_upload import checkEncoding, errorPrint, warnPrint
16 from packages.config import get_path
5 17
6 class CategoryConfig:
18 class CategoryConfig(object):
19 """
20 id_list: dictionary of category name with it's id
21 raw_data: read lines from the file
22 path: path string + encoding
23
24 methods:
25 findConfig
26 readConfig
27 rawConfig
28 """
7 29 def __init__(self): def __init__(self):
8 30 self.id_list = dict() self.id_list = dict()
9 31 self.raw_data = [] self.raw_data = []
10 32 self.path = {'path':'', 'encoding':''} self.path = {'path':'', 'encoding':''}
11 33
12 34 def findConfig(self, root): def findConfig(self, root):
35 """
36 findConfig:
37 search for the category config in 2 ways
38 1. search in the root of the project
39 2. ask the user to identify the file
40 The location of the category config can also
41 be saved into the config file
42 """
43
13 44 try: try:
14 45 self.path['path'] = os.path.join(root, 'category') self.path['path'] = os.path.join(root, 'category')
15 except Exception as err:
16 print("ERROR @ findCategoryConfig: Building path failed: {0}"
17 .format(err))
46 except (ValueError, Exception) as err:
47 errorPrint("Building path failed",
48 err, sys.exc_info()[2].tb_lineno)
18 49 return False return False
19 50
20 if(os.path.isfile(self.path['path'])):
21 self.path = check_encoding(self.path)
51 if os.path.isfile(self.path['path']):
52 self.path = checkEncoding(self.path)
22 53 return True return True
23 else:
24 try:
25 self.path['path'] = get_path(message='category config path',
26 path_type='file',
27 initialdir=root)
28 self.path = check_encoding(self.path)
29 except Exception as err:
30 print("ERROR @ findCategoryConfig: searching file: {0}"
31 .format(err))
32 if(not(self.path['path'])):
33 return False
34 else:
35 return True
54
55 try:
56 self.path['path'] = get_path(message='category config path',
57 path_type='file',
58 initialdir=root)
59 self.path = checkEncoding(self.path)
60 except (ValueError, Exception) as err:
61 errorPrint("searching file failed",
62 err, sys.exc_info()[2].tb_lineno)
63
64 if not self.path['path']:
65 return False
66
67 return True
36 68
37 69
38 70 def rawConfig(self): def rawConfig(self):
71 """
72 rawConfig:
73 read the lines of the categoryConfig
74 without parsing or assing any specific values
75 """
39 76 with open(self.path['path'], with open(self.path['path'],
40 mode='r', encoding=self.path['encoding']) as config:
77 mode='r', encoding=self.path['encoding']) as config:
41 78 try: try:
42 79 self.raw_data =\ self.raw_data =\
43 80 [row.strip(' ').strip('\n').split(';') for row in config] [row.strip(' ').strip('\n').split(';') for row in config]
44 except Exception as err:
45 print("ERROR @ findCategoryConfig: Read data failed: {0}"
46 .format(err))
81 except (ValueError, Exception) as err:
82 errorPrint("raw data read failed",
83 err, sys.exc_info()[2].tb_lineno)
47 84 return len(self.raw_data) > 0 return len(self.raw_data) > 0
48 85
49 86
50 87 def readConfig(self): def readConfig(self):
51 if(not(self.raw_data)):
52 if(not(self.rawConfig())):
88 """
89 readConfig:
90 assign the values found in raw_data to the id_list
91 """
92 if not self.raw_data:
93 if not self.rawConfig():
53 94 return False return False
54 95 for row in self.raw_data: for row in self.raw_data:
55 96 option = "".join(row).split('=') option = "".join(row).split('=')
56 97 if(len(option[0]) > 1 and len(option[1]) > 1): if(len(option[0]) > 1 and len(option[1]) > 1):
57 98 try: try:
58 99 self.id_list[option[0]] = int(option[1]) self.id_list[option[0]] = int(option[1])
59 except Exception as err:
60 print("ERROR @ readCategoryConfig: convert to int: {0}"
61 .format(err))
100 except ValueError as err:
101 warnPrint("Integer conversion failed",
102 sys.exc_info()[2].tb_lineno, err)
62 103 else: else:
63 104 return False return False
64 105
65 106 return True return True
66
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