Skip to content

Commit

Permalink
files reorganization
Browse files Browse the repository at this point in the history
  • Loading branch information
DylannCordel committed Feb 22, 2021
1 parent ab31c2d commit 50ac4bb
Show file tree
Hide file tree
Showing 27 changed files with 84 additions and 74 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Please use version < 1.0.0 (python2 branch) in that case.
from roulier import roulier

payload= {
"auth": {
"auth": {
"login": "12345",
"password": "password",
},
Expand Down Expand Up @@ -72,6 +72,7 @@ print(roulier.get_carriers_action_available())
* [@hparfr](https://github.com/hparfr) ([Akretion.com](https://akretion.com))
* [@damdam-s](https://github.com/damdam-s) ([Camp2Camp.com](http://camptocamp.com))
* [@bealdav](https://github.com/bealdav) ([Akretion.com](https://akretion.com))
* [@DylannCordel](https://github.com/DylannCordel) ([Webu.coop](https://www.webu.coop))


### Dependencies
Expand Down
4 changes: 2 additions & 2 deletions roulier/carriers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from . import laposte_fr
from . import gls_eu
from . import gls_fr
from .gls_fr import rest as gls_fr_rest
from .gls_fr import glsbox as gls_fr_glsbox
from . import chronopost_fr

# from . import geodis
Expand Down
1 change: 0 additions & 1 deletion roulier/carriers/gls_eu/tests/__init__.py

This file was deleted.

7 changes: 0 additions & 7 deletions roulier/carriers/gls_fr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
__version__ = "0.1.0"

from . import api
from . import decoder
from . import encoder
from . import transport
from . import carrier_action
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
__version__ = "0.1.0"

from . import api
from . import carrier_action
from . import decoder
from . import encoder
from . import transport
from . import carrier_action
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Implementation for Laposte."""
from ...carrier_action import CarrierGetLabel
from ...roulier import factory

from roulier.carrier_action import CarrierGetLabel
from roulier.roulier import factory

from .encoder import GlsEncoder
from .decoder import GlsDecoder
from .transport import GlsTransport
Expand All @@ -20,4 +22,4 @@ class GlsFrGetabel(CarrierGetLabel):
web_service_coding = "ISO-8859-1"


factory.register_builder("gls_fr", "get_label", GlsFrGetabel)
factory.register_builder("gls_fr_glsbox", "get_label", GlsFrGetabel)
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
"""Gls weird string -> Python"""

import base64
from io import BytesIO
import logging
import os
from io import BytesIO
import re
from string import Template

from roulier.codec import DecoderGetLabel
from roulier.exception import CarrierError

from .encoder import merge_dict
import base64

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -103,8 +106,6 @@ def create_exception(self, result, exception, ctx_except, data_request):
raise CarrierError(result, exc)

def validate_template(self, template_string, available_keys):
import re

keys2match = []
for match in re.findall(r"\$(T[0-9].*) ", template_string):
keys2match.append(match)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Transform input to gls compatible format"""

import logging
from datetime import date

from roulier.codec import Encoder
Expand All @@ -9,9 +8,6 @@

GLS_ACTIONS = ("label",)

_logger = logging.getLogger(__name__)


DELIVERY_MAPPING = {
# 'address': ADDRESS_MODEL,
"T859": "consignee_ref",
Expand Down Expand Up @@ -99,5 +95,4 @@ def dict_to_exotic_serialization(self, data):
if val:
res += "%s:%s|" % (key, val)
res += r"/////GLS/////"
print(res)
return res
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
""" Implementation for GLS """

import logging
from roulier.carrier import Carrier

from .encoder import GlsEncoder
from .decoder import GlsDecoder
from .transport import GlsTransport

log = logging.getLogger(__name__)


class Gls(Carrier):
"""Implementation for GLS"""
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions roulier/carriers/gls_fr/glsbox/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_roulier_gls_fr
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
from datetime import date
import logging

from roulier import roulier

logger = logging.getLogger(__name__)
Expand All @@ -18,7 +19,7 @@

def test_connexion():
roulier.get(
"gls_fr",
"gls_fr_glsbox",
"get_label",
{
"auth": {"login": credentials["login"], "isTest": credentials["isTest"]},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
""" Implement Gls WS transport"""

import logging
import requests

from roulier.exception import CarrierError
from roulier.transport import RequestsTransport

import logging

log = logging.getLogger(__name__)

Expand Down
7 changes: 7 additions & 0 deletions roulier/carriers/gls_fr/rest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
__version__ = "0.1.0"

from . import api
from . import carrier_action
from . import decoder
from . import encoder
from . import transport
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-
"""Implementation of Laposte Api."""

from roulier.api import ApiParcel
from .constants import SERVICE_STANDARD

from .constants import SERVICE_CHOICES
from .constants import SERVICE_STANDARD


class GlsEuApiParcel(ApiParcel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""Implementation for Laposte."""
from ...carrier_action import CarrierGetLabel
from ...roulier import factory

from roulier.carrier_action import CarrierGetLabel
from roulier.roulier import factory

from .api import GlsEuApiParcel
from .encoder import GlsEuEncoder
from .decoder import GlsEuDecoderGetLabel
from .transport import GlsEuTransport
from .api import GlsEuApiParcel


class GlsEuGetabel(CarrierGetLabel):
Expand All @@ -19,4 +21,4 @@ class GlsEuGetabel(CarrierGetLabel):
manage_multi_label = True


factory.register_builder("gls_eu", "get_label", GlsEuGetabel)
factory.register_builder("gls_fr_rest", "get_label", GlsEuGetabel)
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# -*- coding: utf-8 -*-
"""Laposte XML -> Python."""

import base64
from datetime import datetime
from lxml import objectify

from ...codec import DecoderGetLabel
from roulier.codec import DecoderGetLabel

from .constants import SERVICE_PandR
from .constants import SERVICE_PandS
import base64


class GlsEuDecoderGetLabel(DecoderGetLabel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# -*- coding: utf-8 -*-
"""Transform input to laposte compatible xml."""
import logging

from jinja2 import Environment, PackageLoader
from roulier.exception import InvalidApiInput
import logging

_logger = logging.getLogger(__name__)
from roulier.codec import Encoder
from roulier.exception import InvalidApiInput

from .constants import SERVICE_FDS
from .constants import SERVICE_SHD
from .constants import SERVICE_SRS

_logger = logging.getLogger(__name__)


class GlsEuEncoderBase(Encoder):
def transform_input_to_carrier_webservice(self, data):
Expand Down
1 change: 1 addition & 0 deletions roulier/carriers/gls_fr/rest/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_rest
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-

import logging
from datetime import date
import logging

logger = logging.getLogger(__name__)

Expand Down
Loading

0 comments on commit 50ac4bb

Please sign in to comment.