File size: 1,935 Bytes
35efc3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from pydantic import BaseModel
import requests
import json

class Item(BaseModel):
    FileURL: str = "https://www.bseindia.com/stockinfo/AnnPdfOpen.aspx?Pname=d141ef4f-7856-4236-8f6f-efe09592df40.pdf"
    memo: str = "Please find attached RTA Certificate u/r 74(5) of SEBI (DP) Regulations 2018 for QE March 2024"
    TypeofAnnouncement: str = "General_Announcements"
    Descriptor: str = "Certificate under Reg. 74 (5) of SEBI (DP) Regulations 2018"
    caption: str = "Compliances-Certificate under Reg. 74 (5) of SEBI (DP) Regulations 2018"
    newsdate: str = "2024-04-08T13:05:27"
    symbol: str = "null"

url = "http://jwttoken.cmots.com/cotovia/api/BSEAnnouncement"

header = {"Content-Type":"application/json",
"Authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImNvdG92aWEiLCJyb2xlIjoiQWRtaW4iLCJuYmYiOjE3MTIxNDgzMzMsImV4cCI6MTcxMzAxMjMzMywiaWF0IjoxNzEyMTQ4MzMzLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjUwMTkxIiwiYXVkIjoiaHR0cDovL2xvY2FsaG9zdDo1MDE5MSJ9.kvy4kv29zl0OkmpNXe5hZS2cHdCXF7OrShOFnxzyQfU"}

output = requests.get(url,headers=header)
data = json.loads(output.text)

sample = data['data'][0]

input_data = Item(
    FileURL = sample['FileURL'] or "",
    memo = sample['memo'] or "",
    TypeofAnnouncement = sample['TypeofAnnouncement'] or "",
    Descriptor = sample['Descriptor'] or "",
    caption = sample['caption'] or "",
    newsdate = sample['newsdate'] or "",
    symbol = sample['symbol'] or ""
)

url = "https://tensorgirl-fintech.hf.space/Summarize/"

response = requests.post(url, json = input_data.dict())
print(response.text)
'''
The response would be 0 if the json doesn't pass the filter.
Else it will return data in the form of dictionary who's keys would be as follows:
1. mobile - For 280 words summary
2. web - For 680 words summary
3. tag - Single Tag
4. headline - It will give the headline
5. date-time - It will give the time and date when the summary was created
'''