arthurtyukayev / python-safer Goto Github PK
View Code? Open in Web Editor NEWA web scraping API written in Python to fetch data from the Department of Transportation's https://safer.fmcsa.dot.gov
License: MIT License
A web scraping API written in Python to fetch data from the Department of Transportation's https://safer.fmcsa.dot.gov
License: MIT License
Calling get_by_usdot_number
with 3279824 throws a value error. For some reason it's pulling the Inspections/Crashes In US
table instead of the Safety Rating
table. It seems to only happen for random DOTs and I'm not sure where the mismatch is in the UI for this to happen.
Traceback (most recent call last):
File ".../CompanySnapshot.py", line 20, in <module>
getCarrierInfoByDOT(3279824)
File ".../CompanySnapshot.py", line 6, in getCarrierInfoByDOT
company = client.get_by_usdot_number(dot)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/safer/search.py", line 83, in get_by_usdot_number
return Company(
^^^^^^^^
File ".../venv/lib/python3.11/site-packages/safer/results.py", line 50, in __init__
self.__safety_rating_date = datetime.strptime(data['safety_review_date'], "%m/%d/%Y") if data[
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '41' does not match format '%m/%d/%Y'
It seems that as soon as a number is entered into the system you can use the portal and search it. It will only return the company name. But it seems about after 24 hours when searching https://safer.fmcsa.dot.gov/CompanySnapshot.aspx it will then contain all the info about the USDOT number. Is there a way to get this data immediately without having to wait 24 hours?
Big fan of this as their APIs are not documented so great work. However:
ModuleNotFoundError: No module named 'safer' ```
On Python 3.7.4. MacOSX. Installed using `pip install python-safer` is instructed.
when I run a `pip list | grep safer` it only shows python-safer.
Now, when I try to run with ```import python-safer``` etc I get this:
File "main.py", line 1
from python-safer import CompanySnapshot
^
SyntaxError: invalid syntax
result error: IndexError: No value at index 0.
for value "python"
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.