How to get weekly data from MetaTrader 5 using python

 
ticks = mt5.copy_rates_range(
    'WIN$N', 
    mt5.TIMEFRAME_H1, 
    datetime(2022, 2, 28),
    datetime(2022, 3, 4),
)
I'm using the above script to get weekly data, but I'm getting an empty dataframe. In MetaTrader5 documentation there is nothing about Weekly data, someone knows how to get it?
 

This is the code I use to get any data from metatrader5 which always works for me. Make sure to change account number, password and pair symbole, also the server name (here i am using Exness trial account)


import numpy as np
import pandas as pd
import MetaTrader5 as mt5
from datetime import datetime

account=12345678      #account number
password = "password"
pair = 'USDJPYm'   #as shown in metatrader5

if not mt5.initialize(login=account, password=password,server="Exness-MT5Trial"):
        print("initialize() failed, error code =",mt5.last_error())
        quit()
         
# attempt to enable the display of the pair in MarketWatch
selected=mt5.symbol_select(pair,True)
if not selected:
    print("Failed to select {}".format(pair))
    mt5.shutdown()
    quit()  
    

utc_from = datetime.now() #Todays time

# get 20 data bars of 'USDJPYm' [ Weekly= W1, 4 Hours= H4, Daily= D1] starting from today's time in UTC time zone
rates = mt5.copy_rates_from(pair, mt5.TIMEFRAME_W1, utc_from, 20)
# create DataFrame out of the obtained data
data = pd.DataFrame(rates)
# convert time in seconds into the datetime format
data['time']=pd.to_datetime(data['time'], unit='s')

data.head()