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

File is not a zip file #83

Open
Karan-Singh01 opened this issue Sep 30, 2024 · 0 comments
Open

File is not a zip file #83

Karan-Singh01 opened this issue Sep 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Karan-Singh01
Copy link

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
@Karan-Singh01 Karan-Singh01 added the bug Something isn't working label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant