Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: get data from etraffic api #8

Merged
merged 9 commits into from
Jan 24, 2025
Merged

feat: get data from etraffic api #8

merged 9 commits into from
Jan 24, 2025

Conversation

NTGNguyen
Copy link
Contributor

implement #1

@NTGNguyen
Copy link
Contributor Author

Currently, it doesn't work because the URL has banned me from making more requests, so I can't parse the data for violation details.

{
    "guid": "ed9999-9999-9999-9999-9999999999",
    "code": "CIT_999",
    "message": "Số lượt tìm kiếm thông tin phạt  nguội đã đạt giới hạn trong ngày.\nVui lòng thử lại sau",
    "status": 400,
    "path": "/v2/property/deferred/fines",
    "method": "GET",
    "timestamp": "2025-01-18T16:42:18Z",
    "errors": None,
}

@NTGNguyen
Copy link
Contributor Author

Ok I find the ex of plate data in this api:

{
  "status": 200,
  "message": "OK",
  "data": [
    {
      "violationId": null,
      "licensePlate": "29A34809",
      "licensePlateType": "Nền màu trắng, chữ và số màu đen",
      "vehicleType": "Ô tô con",
      "vehicleTypeText": "Ô tô con",
      "violationType": null,
      "violationTypeText": "Liên hệ địa điểm nộp phạt để nhận hình ảnh VP",
      "violationAt": "15:06 21/02/2021",
      "violationAtText": "15:06 21/02/2021",
      "violationAddress": "Hà Nội",
      "handlingAddress": "54 Trần Hưng Đạo - Hoàn Kiếm - Hà Nội",
      "propertyName": "Thành phố Hà Nội\nĐịa chỉ: 54 Trần Hưng Đạo - Hoàn Kiếm - Hà Nội\nLiên lạc: 0692196440",
      "statusType": "Đã xử phạt",
      "statusTypeText": "Đã xử phạt",
      "departmentName": "Thành phố Hà Nội\nĐịa chỉ: 54 Trần Hưng Đạo - Hoàn Kiếm - Hà Nội\nLiên lạc: 0692196440",
      "contactPhone": "0692196440"
    },
    {
      "violationId": null,
      "licensePlate": "29A34809",
      "licensePlateType": "Nền màu trắng, chữ và số màu đen",
      "vehicleType": "Ô tô con",
      "vehicleTypeText": "Ô tô con",
      "violationType": null,
      "violationTypeText": "Liên hệ địa điểm nộp phạt để nhận hình ảnh VP",
      "violationAt": "09:36 21/02/2021",
      "violationAtText": "09:36 21/02/2021",
      "violationAddress": "Hà Nội",
      "handlingAddress": "54 Trần Hưng Đạo - Hoàn Kiếm - Hà Nội",
      "propertyName": "Thành phố Hà Nội\nĐịa chỉ: 54 Trần Hưng Đạo - Hoàn Kiếm - Hà Nội\nLiên lạc: 0692196440",
      "statusType": "Đã xử phạt",
      "statusTypeText": "Đã xử phạt",
      "departmentName": "Thành phố Hà Nội\nĐịa chỉ: 54 Trần Hưng Đạo - Hoàn Kiếm - Hà Nội\nLiên lạc: 0692196440",
      "contactPhone": "0692196440"
    },
    {
      "violationId": null,
      "licensePlate": "29A34809",
      "licensePlateType": "Nền màu trắng, chữ và số màu đen",
      "vehicleType": "Ô tô con",
      "vehicleTypeText": "Ô tô con",
      "violationType": null,
      "violationTypeText": "Liên hệ địa điểm nộp phạt để nhận hình ảnh VP",
      "violationAt": "10:00 12/08/2020",
      "violationAtText": "10:00 12/08/2020",
      "violationAddress": "Hà Nội",
      "handlingAddress": "54 Trần Hưng Đạo - Hoàn Kiếm - Hà Nội",
      "propertyName": "Thành phố Hà Nội\nĐịa chỉ: 54 Trần Hưng Đạo - Hoàn Kiếm - Hà Nội\nLiên lạc: 0692196440",
      "statusType": "Đã xử phạt",
      "statusTypeText": "Đã xử phạt",
      "departmentName": "Thành phố Hà Nội\nĐịa chỉ: 54 Trần Hưng Đạo - Hoàn Kiếm - Hà Nội\nLiên lạc: 0692196440",
      "contactPhone": "0692196440"
    }
  ]
}

pyproject.toml Outdated
@@ -16,7 +16,7 @@ dependencies = [
[project.optional-dependencies]
discord = ["audioop-lts>=0.2.1", "discord-py>=2.4.0"]
ocr = ["pytesseract>=0.3.13"]

etraffic = ["curl-cffi>=0.7.4"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change deps optional name to curl

@KevinNitroG KevinNitroG marked this pull request as draft January 19, 2025 07:41
@KevinNitroG KevinNitroG added the enhancement New feature or request label Jan 19, 2025
@KevinNitroG KevinNitroG linked an issue Jan 19, 2025 that may be closed by this pull request
Copy link
Member

@KevinNitroG KevinNitroG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the optional deps name

@KevinNitroG
Copy link
Member

Currently, it doesn't work because the URL has banned me from making more requests, so I can't parse the data for violation details.

{
    "guid": "ed9999-9999-9999-9999-9999999999",
    "code": "CIT_999",
    "message": "Số lượt tìm kiếm thông tin phạt  nguội đã đạt giới hạn trong ngày.\nVui lòng thử lại sau",
    "status": 400,
    "path": "/v2/property/deferred/fines",
    "method": "GET",
    "timestamp": "2025-01-18T16:42:18Z",
    "errors": None,
}

How ut could be None in the errors field?? :)) it must be null in json?

@NTGNguyen NTGNguyen marked this pull request as ready for review January 24, 2025 09:01
@NTGNguyen NTGNguyen requested a review from KevinNitroG January 24, 2025 09:02
- Make _request return a _Response Typedict class object
- Log when _request return None(This request fail)
@KevinNitroG KevinNitroG merged commit e181ae1 into main Jan 24, 2025
4 checks passed
@KevinNitroG KevinNitroG deleted the feat/etraffic-api branch January 24, 2025 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add api etraffic.gtelict.vn
2 participants