aftership / aftership-sdk-python Goto Github PK
View Code? Open in Web Editor NEWThe python SDK of AfterShip API
License: MIT License
The python SDK of AfterShip API
License: MIT License
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.
Unable to delete tracking for deutsch-post as it requires tracking_ship_date :-/
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!!
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.`
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.
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 ?
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?
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.