Giter VIP home page Giter VIP logo

aftership-sdk-python's People

Contributors

afaulconbridge avatar alviezhang avatar beaelf avatar fedor avatar jkzhang-aftership avatar russelldavies avatar sunznx avatar teddychan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aftership-sdk-python's Issues

get_tracking with only tracking_number

When I call this:
aftership.tracking.get_tracking(tracking_number=tracking_number)

I get this error:
ValueError: You must specify the tracking number of tracking id

Which doesn't make any sense. All I have is the tracking number; can't I retrieve information just based on that?

test send slack msg

Versions
Python version:
SDK version:
OS type:
OS version:
OS architecture:

Describe the bug
A clear and concise description of what the bug is, steps to reproduce the behavior.

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Versions
Python version: Python 3.8.6
SDK version:
OS type: Linux
OS version: CentOS
OS architecture:

Describe the bug
I am using aftership-sdk-python library (aftership==1.0.post2) api create tracking api for posting orders to aftership since a month ago. I am using it as a batch process, processing around 10k records per day. since 2 days back, for few records I am getting this error below.. I tested my code, the argument I pass has no error but I get this error in the python module

Traceback (most recent call last):
    aftership.tracking.create_tracking(tracking=track_dict)
  File "/opt/root/lib64/python3.8/site-packages/aftership/tracking.py", line 10, in create_tracking
    return process_response(response)
  File "/opt/root/lib64/python3.8/site-packages/aftership/response.py", line 14, in process_response
    json_content = response.json()
  File "/opt/root/lib64/python3.8/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/opt/rh/rh-python38/root/usr/lib64/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/opt/rh/rh-python38/root/usr/lib64/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/opt/rh/rh-python38/root/usr/lib64/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I get this error while using below code in loop

dict = {   "slug": carrier,
               "title": "",
               "emails": "",
               "customer_name": "",
                "order_id": order_id
           }

aftership.tracking.create_tracking(tracking=dict)

Could you please let me know how can I tackle this error, what happens sometimes is that even if I get this error, the record sometimes still gets posted to aftership, so if it tries to run second time I get BadRequest: Tracking already exists. as this outcome is related to another piece in my code, so I might need this error handled.

Please let me know if you need more details about this error.

Update:

If I add content-type in headers, will that solve my problem ? something like below: Please let me know

tracking = aftership.tracking.create_tracking(tracking=track_dict, headers={"Content-Type": "application/json"})

Thanks

SSL certificate

Hello there,
I've been using this package for a few months and it has been working well, but in the last days I've noted this SSL error:

urllib3 logged just before hitting aftership.com:

INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.aftership.com

and trackback:

Traceback (most recent call last):
  File "/home/myuser/my_function.py", line 96, in handler
    api.trackings.post(tracking=tracking)
  File "/usr/lib/python2.7/site-packages/aftership/__init__.py", line 87, in post
    return self.request('post', *args, **body)
  File "/usr/lib/python2.7/site-packages/aftership/__init__.py", line 81, in request
    return self._base.call(method, self._path, *args, **body)
  File "/usr/lib/python2.7/site-packages/aftership/__init__.py", line 259, in call
    return APIv3.call(self, *args, **body)
  File "/usr/lib/python2.7/site-packages/aftership/__init__.py", line 212, in call
    response = API.call(self, *args, **body)['data']
  File "/usr/lib/python2.7/site-packages/aftership/__init__.py", line 139, in call
    params=params, data=body)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 53, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 447, in send
    raise SSLError(e, request=request)
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)

Wondering if the certificate really expired. I also did run this command:

openssl s_client -connect api.aftership.com:443

and the output looks normal. Any help will be super welcomed!!

Attribute error :'module' object has no attribute 'tracking'

When I run Aftership_tracking_example.py with updated API key and tracking number , I receive the following error
: Attribute error :'module' object has no attribute 'tracking' . I have downloaded and installed Aftership module using pip. I also see tracking.py in that module. Could you please help me with this issue ?

get_tracking for postnl-3s courier

Postnl-3s courier requires tracking_destination_country and tracking_postal_code to be specified to retrieve a tracking.
However, currently it's not possible to specify those via aftership.tracking.get_tracking method (it only allows for the optional_keys to be passed along).

Details:
aftership.tracking.get_tracking(slug="postnl-3s", tracking_number="XYZ")
throws
aftership.exception.BadRequest: BadRequest: \'tracking_destination_country\' is required.
and then (once the first one is hacked in)
aftership.exception.BadRequest: BadRequest: \'tracking_postal_code\ is required.`

Search by title

Hi,

Is there a way to add a filter to search by title ?

Even if I wanna reduce the scope of the search like this:

orderTitle = "Order 796956"
returnAfterShip = api.trackings.get(slug='ups', keywords=[orderTitle], limit=1)

I'm not getting the expected result.

FileNotFoundError

It seems the latest release to this package is unstable.

image

Let me know if I am doing something wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.