Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from .. import distributor
from ..global_vars import distributor_dict
class dist_tme(distributor.distributor):
@staticmethod
def dist_init_distributor_dict():
distributor_dict.update(
{
'tme': {
'octopart_name': 'TME',
'module': 'tme', # The directory name containing this file.
'scrape': 'web', # Allowable values: 'web' or 'local'.
'label': 'TME', # Distributor label used in spreadsheet columns.
'order_cols': ['part_num', 'purch', 'refs'], # Sort-order for online orders.
'order_delimiter': ' ', # Delimiter for online orders.
# Formatting for distributor header in worksheet.
'wrk_hdr_format': {
'font_size': 14,
'font_color': 'white',
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from .. import distributor
from ..global_vars import distributor_dict
class dist_digikey(distributor.distributor):
@staticmethod
def dist_init_distributor_dict():
distributor_dict.update(
{
'digikey': {
'octopart_name': 'Digi-Key',
'module': 'digikey', # The directory name containing this file.
'scrape': 'web', # Allowable values: 'web' or 'local'.
'label': 'Digi-Key', # Distributor label used in spreadsheet columns.
'order_cols': ['purch', 'part_num', 'refs'], # Sort-order for online orders.
'order_delimiter': ',', # Delimiter for online orders.
# Formatting for distributor header in worksheet.
'wrk_hdr_format': {
'font_size': 14,
'font_color': 'white',
import re, difflib
from bs4 import BeautifulSoup
import http.client # For web scraping exceptions.
from ...globals import PartHtmlError
from ...globals import logger, DEBUG_OVERVIEW, DEBUG_DETAILED, DEBUG_OBSESSIVE, DEBUG_HTTP_RESPONSES
from .. import fake_browser
from .. import distributor
from ..global_vars import distributor_dict, EXTRA_INFO_DIST, extra_info_dist_name_translations
from urllib.parse import quote_plus as urlquote
import pycountry
class dist_digikey(distributor.distributor):
def __init__(self, name, scrape_retries, throttle_delay):
super(dist_digikey, self).__init__(name, distributor_dict[name]['site']['url'],
scrape_retries, throttle_delay)
self.browser.start_new_session()
@staticmethod
def dist_init_distributor_dict():
distributor_dict.update(
{
'digikey': {
'module': 'digikey', # The directory name containing this file.
'scrape': 'web', # Allowable values: 'web' or 'local'.
'label': 'Digi-Key', # Distributor label used in spreadsheet columns.
'order_cols': ['purch', 'part_num', 'refs'], # Sort-order for online orders.
'order_delimiter': ',', # Delimiter for online orders.
# Formatting for distributor header in worksheet.
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from .. import distributor
from ..global_vars import distributor_dict
class dist_mouser(distributor.distributor):
@staticmethod
def dist_init_distributor_dict():
distributor_dict.update({
'mouser': {
'octopart_name': 'Mouser',
'module': 'mouser', # The directory name containing this file.
'scrape': 'web', # Allowable values: 'web' or 'local'.
'label': 'Mouser', # Distributor label used in spreadsheet columns.
'order_cols': ['part_num', 'purch', 'refs'], # Sort-order for online orders.
'order_delimiter': ' ', # Delimiter for online orders.
# Formatting for distributor header in worksheet.
'wrk_hdr_format': {
'font_size': 14,
'font_color': 'white',
'bold': True,
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from .. import distributor
from ..global_vars import distributor_dict
class dist_rs(distributor.distributor):
@staticmethod
def dist_init_distributor_dict():
distributor_dict.update(
{
'rs': {
'octopart_name': 'RS Components',
'module': 'rs', # The directory name containing this file.
'scrape': 'web', # Allowable values: 'web' or 'local'.
'label': 'RS Components', # Distributor label used in spreadsheet columns.
'order_cols': ['part_num', 'purch', 'refs'], # Sort-order for online orders.
'order_delimiter': ' ', # Delimiter for online orders.
# Formatting for distributor header in worksheet.
'wrk_hdr_format': {
'font_size': 14,
'font_color': 'white',
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from .. import distributor
from ..global_vars import distributor_dict
class dist_arrow(distributor.distributor):
@staticmethod
def dist_init_distributor_dict():
distributor_dict.update({
'arrow': {
'octopart_name': 'Arrow Electronics, Inc.',
'module': 'arrow', # The directory name containing this file.
'scrape': 'web', # Allowable values: 'web' or 'local'.
'label': 'Arrow', # Distributor label used in spreadsheet columns.
'order_cols': ['part_num', 'purch', 'refs'], # Sort-order for online orders.
'order_delimiter': ',', # Delimiter for online orders.
# Formatting for distributor header in worksheet.
'wrk_hdr_format': {
'font_size': 14,
'font_color': 'white',
'bold': True,
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from .. import distributor
from ..global_vars import distributor_dict
class dist_newark(distributor.distributor):
@staticmethod
def dist_init_distributor_dict():
distributor_dict.update({
'newark': {
'octopart_name': 'Newark',
'module': 'newark', # The directory name containing this file.
'scrape': 'web', # Allowable values: 'web' or 'local'.
'label': 'Newark', # Distributor label used in spreadsheet columns.
'order_cols': ['part_num', 'purch', 'refs'], # Sort-order for online orders.
'order_delimiter': ',', # Delimiter for online orders.
# Formatting for distributor header in worksheet.
'wrk_hdr_format': {
'font_size': 14,
'font_color': 'white',
'bold': True,
import re, difflib
from bs4 import BeautifulSoup
import http.client # For web scraping exceptions.
from ...global_vars import PartHtmlError
from ...global_vars import logger, DEBUG_OVERVIEW, DEBUG_DETAILED, DEBUG_OBSESSIVE, DEBUG_HTTP_RESPONSES
from .. import fake_browser
from .. import distributor
from ..global_vars import distributor_dict
from urllib.parse import quote_plus as urlquote
import pycountry
class dist_mouser(distributor.distributor):
def __init__(self, name, scrape_retries, throttle_delay):
super(dist_mouser, self).__init__(name, distributor_dict[name]['site']['url'],
scrape_retries, throttle_delay)
self.browser.start_new_session()
@staticmethod
def dist_init_distributor_dict():
distributor_dict.update(
{
'mouser': {
'module': 'mouser', # The directory name containing this file.
'scrape': 'web', # Allowable values: 'web' or 'local'.
'label': 'Mouser', # Distributor label used in spreadsheet columns.
'order_cols': ['part_num', 'purch', 'refs'], # Sort-order for online orders.
'order_delimiter': ' ', # Delimiter for online orders.
# Formatting for distributor header in worksheet.
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from .. import distributor
from ..global_vars import distributor_dict
class dist_farnell(distributor.distributor):
@staticmethod
def dist_init_distributor_dict():
distributor_dict.update({
'farnell': {
'octopart_name': 'Farnell',
'module': 'farnell', # The directory name containing this file.
'scrape': 'web', # Allowable values: 'web' or 'local'.
'label': 'Farnell', # Distributor label used in spreadsheet columns.
'order_cols': ['part_num', 'purch', 'refs'], # Sort-order for online orders.
'order_delimiter': ' ', # Delimiter for online orders.
# Formatting for distributor header in worksheet.
'wrk_hdr_format': {
'font_size': 14,
'font_color': 'white',
'bold': True,