Skip to content

File is not a zip file #83

@Karan-Singh01

Description

@Karan-Singh01

Issue description

Error downloading Bhavcopy : File is not a zip file

Example Code

from jugaad_data.nse import bhavcopy_save
from datetime import date, timedelta

file_path = "C:/Users/Admin"

start_date = date(2024, 9, 1)
end_date = date(2024, 9, 29)


for single_date in (start_date + timedelta(n) for n in range((end_date - start_date).days + 1)):
    if single_date.weekday() >= 5:
       print(f"Skipping weekend: {single_date}")
       continue
    
    try:
        print(f"Downloading Bhavcopy for: {single_date}")
        bhavcopy_save(single_date, file_path)
    except Exception as e:
        print(f"Error downloading Bhavcopy for {single_date}: {e}")

Error snippet

Skipping weekend: 2024-09-01
Downloading Bhavcopy for: 2024-09-02
Error downloading Bhavcopy for 2024-09-02: File is not a zip file
Downloading Bhavcopy for: 2024-09-03
Error downloading Bhavcopy for 2024-09-03: File is not a zip file
Downloading Bhavcopy for: 2024-09-04
Error downloading Bhavcopy for 2024-09-04: File is not a zip file
Downloading Bhavcopy for: 2024-09-05
Error downloading Bhavcopy for 2024-09-05: File is not a zip file
Downloading Bhavcopy for: 2024-09-06
Error downloading Bhavcopy for 2024-09-06: File is not a zip file
Skipping weekend: 2024-09-07
Skipping weekend: 2024-09-08
Downloading Bhavcopy for: 2024-09-09
Error downloading Bhavcopy for 2024-09-09: File is not a zip file
Downloading Bhavcopy for: 2024-09-10
Error downloading Bhavcopy for 2024-09-10: File is not a zip file
Downloading Bhavcopy for: 2024-09-11
Error downloading Bhavcopy for 2024-09-11: File is not a zip file
Downloading Bhavcopy for: 2024-09-12
Error downloading Bhavcopy for 2024-09-12: File is not a zip file
Downloading Bhavcopy for: 2024-09-13
Error downloading Bhavcopy for 2024-09-13: File is not a zip file
Skipping weekend: 2024-09-14
Skipping weekend: 2024-09-15
Downloading Bhavcopy for: 2024-09-16
Error downloading Bhavcopy for 2024-09-16: File is not a zip file
Downloading Bhavcopy for: 2024-09-17
Error downloading Bhavcopy for 2024-09-17: File is not a zip file
Downloading Bhavcopy for: 2024-09-18
Error downloading Bhavcopy for 2024-09-18: File is not a zip file
Downloading Bhavcopy for: 2024-09-19
Error downloading Bhavcopy for 2024-09-19: File is not a zip file
Downloading Bhavcopy for: 2024-09-20
Error downloading Bhavcopy for 2024-09-20: File is not a zip file
Skipping weekend: 2024-09-21
Skipping weekend: 2024-09-22
Downloading Bhavcopy for: 2024-09-23
Error downloading Bhavcopy for 2024-09-23: File is not a zip file
Downloading Bhavcopy for: 2024-09-24
Error downloading Bhavcopy for 2024-09-24: File is not a zip file
Downloading Bhavcopy for: 2024-09-25
Error downloading Bhavcopy for 2024-09-25: File is not a zip file
Downloading Bhavcopy for: 2024-09-26
Error downloading Bhavcopy for 2024-09-26: File is not a zip file
Downloading Bhavcopy for: 2024-09-27
Error downloading Bhavcopy for 2024-09-27: File is not a zip file
Skipping weekend: 2024-09-28
Skipping weekend: 2024-09-29

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions