update code
Browse files- app.py +10 -131
- privacy_policy +0 -0
- requirements.txt +2 -1
- text.html +16 -9
app.py
CHANGED
|
@@ -1,145 +1,22 @@
|
|
| 1 |
-
from fastapi import FastAPI
|
| 2 |
from bs4 import BeautifulSoup
|
| 3 |
import time
|
| 4 |
import requests
|
| 5 |
from fastapi.responses import HTMLResponse
|
| 6 |
from starlette.responses import FileResponse
|
|
|
|
| 7 |
|
| 8 |
app = FastAPI(
|
| 9 |
title="PSX web scraper",
|
| 10 |
docs_url="/",
|
| 11 |
description="Scrape data from PSX website"
|
| 12 |
)
|
| 13 |
-
html_content = """
|
| 14 |
|
| 15 |
-
|
| 16 |
-
<html lang="en">
|
| 17 |
-
<head>
|
| 18 |
-
<meta charset="utf-8" />
|
| 19 |
-
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
| 20 |
-
<title>Privacy Policy — [YOUR APP NAME]</title>
|
| 21 |
-
<style>
|
| 22 |
-
:root{
|
| 23 |
-
--bg:#ffffff;
|
| 24 |
-
--text:#222;
|
| 25 |
-
--muted:#555;
|
| 26 |
-
--accent:#5F27CD;
|
| 27 |
-
--container:#f8f8f8;
|
| 28 |
-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
|
| 29 |
-
}
|
| 30 |
-
body{
|
| 31 |
-
background: var(--bg);
|
| 32 |
-
color: var(--text);
|
| 33 |
-
margin:0;
|
| 34 |
-
padding:24px;
|
| 35 |
-
line-height:1.6;
|
| 36 |
-
}
|
| 37 |
-
.wrap{
|
| 38 |
-
max-width:900px;
|
| 39 |
-
margin:24px auto;
|
| 40 |
-
background:var(--container);
|
| 41 |
-
padding:28px;
|
| 42 |
-
border-radius:12px;
|
| 43 |
-
box-shadow:0 6px 20px rgba(0,0,0,0.06);
|
| 44 |
-
}
|
| 45 |
-
h1{ margin-top:0; color:var(--accent); }
|
| 46 |
-
h2{ margin-bottom:6px; color:#222; }
|
| 47 |
-
p{ margin:12px 0; }
|
| 48 |
-
ul{ margin:12px 0 12px 20px; }
|
| 49 |
-
.muted{ color:var(--muted); font-size:0.95em; }
|
| 50 |
-
.note{ background:#fff6f6; border-left:4px solid #ffb5b5; padding:12px; border-radius:6px; }
|
| 51 |
-
footer{ margin-top:28px; font-size:.95em; color:var(--muted); }
|
| 52 |
-
a{ color:var(--accent); text-decoration:none; }
|
| 53 |
-
@media (max-width:600px){
|
| 54 |
-
body{ padding:14px; }
|
| 55 |
-
.wrap{ padding:18px; border-radius:10px; }
|
| 56 |
-
}
|
| 57 |
-
</style>
|
| 58 |
-
</head>
|
| 59 |
-
<body>
|
| 60 |
-
<div class="wrap" role="main">
|
| 61 |
-
<h1>Privacy Policy</h1>
|
| 62 |
-
<p class="muted"><strong>[YOUR APP NAME]</strong> — Last updated: <strong>[DATE]</strong></p>
|
| 63 |
-
|
| 64 |
-
<p>
|
| 65 |
-
<strong>[YOUR APP NAME]</strong> (“we”, “our”, or “the app”) provides Pakistan Stock Exchange (PSX) market data, watchlist functionality, and related market insights. Your privacy matters to us. This Privacy Policy explains what information we collect, how we use it, and the choices you have.
|
| 66 |
-
</p>
|
| 67 |
-
|
| 68 |
-
<h2>1. Information We Collect</h2>
|
| 69 |
-
|
| 70 |
-
<h3>1.1 Personal Data</h3>
|
| 71 |
-
<p>We do <strong>not</strong> collect personally identifiable information such as your name, CNIC, phone number, postal address, or email address by default.</p>
|
| 72 |
-
|
| 73 |
-
<h3>1.2 Usage Data</h3>
|
| 74 |
-
<p>We may collect non-personal usage information to help improve the app. This can include:</p>
|
| 75 |
-
<ul>
|
| 76 |
-
<li>App interactions (screens opened, buttons tapped)</li>
|
| 77 |
-
<li>Device type and operating system</li>
|
| 78 |
-
<li>Crash logs and performance metrics</li>
|
| 79 |
-
</ul>
|
| 80 |
-
|
| 81 |
-
<h3>1.3 Watchlist Data</h3>
|
| 82 |
-
<p>Your watchlist is stored locally on your device. We do not upload watchlist items to our servers unless we explicitly add a cloud-sync feature in a future version (we will update this policy if that changes).</p>
|
| 83 |
-
|
| 84 |
-
<h3>1.4 Stock Market Data</h3>
|
| 85 |
-
<p>Market data (quotes, charts, market status) is fetched from public or authorized third-party sources. This data is market data only and does not include any personal information.</p>
|
| 86 |
-
|
| 87 |
-
<h2>2. How We Use Information</h2>
|
| 88 |
-
<p>We use the limited data we collect for the following purposes:</p>
|
| 89 |
-
<ul>
|
| 90 |
-
<li>Improve app performance and reliability</li>
|
| 91 |
-
<li>Diagnose and fix bugs and crashes</li>
|
| 92 |
-
<li>Enhance user experience and UI</li>
|
| 93 |
-
<li>Display PSX market data within the app</li>
|
| 94 |
-
</ul>
|
| 95 |
-
<p>We do <strong>not</strong> sell your personal information, nor do we use collected data for targeted advertising or user profiling.</p>
|
| 96 |
-
|
| 97 |
-
<h2>3. Third-Party Services</h2>
|
| 98 |
-
<p>The app may use third-party services which collect anonymous usage or crash data. Examples include but are not limited to:</p>
|
| 99 |
-
<ul>
|
| 100 |
-
<li>Firebase Analytics</li>
|
| 101 |
-
<li>Firebase Crashlytics</li>
|
| 102 |
-
<li>Google Play Services (for Play Store integration)</li>
|
| 103 |
-
</ul>
|
| 104 |
-
<p>These services operate under their own privacy policies. We do not share personally identifiable information with these services.</p>
|
| 105 |
-
|
| 106 |
-
<h2>4. Advertisements</h2>
|
| 107 |
-
<p class="muted">If your app has no ads, remove this block or use the “no ads” variant below.</p>
|
| 108 |
-
|
| 109 |
-
<div class="note">
|
| 110 |
-
<strong>If your app does not display ads:</strong>
|
| 111 |
-
<p>The app does <strong>not</strong> display advertisements and does not use or share data with ad networks.</p>
|
| 112 |
-
</div>
|
| 113 |
-
|
| 114 |
-
<!-- If you DO use ads, replace the above block with the following and remove the .note -->
|
| 115 |
-
<!--
|
| 116 |
-
<p>The app may display third-party advertisements. Third-party ad networks may collect anonymous identifiers (for example, Advertising ID) to provide relevant ads. We do not provide any personal data to ad networks.</p>
|
| 117 |
-
-->
|
| 118 |
-
|
| 119 |
-
<h2>5. Security</h2>
|
| 120 |
-
<p>We implement reasonable technical and organizational measures to protect data stored locally or transmitted from the app. However, no method of transmission or electronic storage is 100% secure. Your watchlist and any local data remain on your device unless you opt-in to cloud sync in a future version.</p>
|
| 121 |
-
|
| 122 |
-
<h2>6. Children’s Privacy</h2>
|
| 123 |
-
<p>This app is not intended for use by children under the age of 13. We do not knowingly collect personal information from children under 13.</p>
|
| 124 |
-
|
| 125 |
-
<h2>7. Changes to This Privacy Policy</h2>
|
| 126 |
-
<p>We may update this Privacy Policy occasionally. Changes will be posted in the app and, if applicable, on our website. The “Last updated” date at the top reflects when the policy was last revised.</p>
|
| 127 |
-
|
| 128 |
-
<h2>8. Contact Us</h2>
|
| 129 |
-
<p>If you have questions about this Privacy Policy, please contact us:</p>
|
| 130 |
-
<ul>
|
| 131 |
-
<li><strong>Email:</strong> <a href="mailto:[YOUR EMAIL]">[YOUR EMAIL]</a></li>
|
| 132 |
-
<li><strong>Developer / Company:</strong> [YOUR NAME / COMPANY]</li>
|
| 133 |
-
</ul>
|
| 134 |
-
|
| 135 |
-
<footer>
|
| 136 |
-
<p class="muted">This Privacy Policy was generated to help you comply with app store requirements. This document does not constitute legal advice. If your app collects additional personal data, implements analytics, advertising, payments, or cloud features, consider consulting a legal professional to ensure compliance with applicable laws (including GDPR, CCPA, or local Pakistani data protection laws) and store policies.</p>
|
| 137 |
-
</footer>
|
| 138 |
-
</div>
|
| 139 |
-
</body>
|
| 140 |
-
</html>
|
| 141 |
|
|
|
|
| 142 |
|
|
|
|
| 143 |
|
| 144 |
"""
|
| 145 |
|
|
@@ -212,10 +89,12 @@ def greet_json():
|
|
| 212 |
def get_dividend():
|
| 213 |
return simple_dividend_extraction()
|
| 214 |
|
| 215 |
-
@app.get("/PrivacyPolicy")
|
| 216 |
-
def get_privacy_policy():
|
| 217 |
|
| 218 |
-
return
|
|
|
|
|
|
|
| 219 |
|
| 220 |
|
| 221 |
|
|
|
|
| 1 |
+
from fastapi import FastAPI,Request
|
| 2 |
from bs4 import BeautifulSoup
|
| 3 |
import time
|
| 4 |
import requests
|
| 5 |
from fastapi.responses import HTMLResponse
|
| 6 |
from starlette.responses import FileResponse
|
| 7 |
+
from fastapi.templating import Jinja2Templates
|
| 8 |
|
| 9 |
app = FastAPI(
|
| 10 |
title="PSX web scraper",
|
| 11 |
docs_url="/",
|
| 12 |
description="Scrape data from PSX website"
|
| 13 |
)
|
|
|
|
| 14 |
|
| 15 |
+
templates = Jinja2Templates(directory="templates")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
html_content = """
|
| 18 |
|
| 19 |
+
|
| 20 |
|
| 21 |
"""
|
| 22 |
|
|
|
|
| 89 |
def get_dividend():
|
| 90 |
return simple_dividend_extraction()
|
| 91 |
|
| 92 |
+
@app.get("/PrivacyPolicy",response_class=HTMLResponse)
|
| 93 |
+
async def get_privacy_policy(request: Request):
|
| 94 |
|
| 95 |
+
return templates.TemplateResponse(
|
| 96 |
+
request=request, name="text.html"
|
| 97 |
+
)
|
| 98 |
|
| 99 |
|
| 100 |
|
privacy_policy
ADDED
|
File without changes
|
requirements.txt
CHANGED
|
@@ -2,4 +2,5 @@ fastapi
|
|
| 2 |
uvicorn
|
| 3 |
requests
|
| 4 |
beautifulsoup4
|
| 5 |
-
selenium
|
|
|
|
|
|
| 2 |
uvicorn
|
| 3 |
requests
|
| 4 |
beautifulsoup4
|
| 5 |
+
selenium
|
| 6 |
+
jinja2
|
text.html
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
-
<!doctype html>
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="utf-8" />
|
| 5 |
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
| 6 |
-
<title>Privacy Policy —
|
| 7 |
<style>
|
| 8 |
:root{
|
| 9 |
--bg:#ffffff;
|
|
@@ -45,10 +45,10 @@
|
|
| 45 |
<body>
|
| 46 |
<div class="wrap" role="main">
|
| 47 |
<h1>Privacy Policy</h1>
|
| 48 |
-
<p class="muted"><strong>
|
| 49 |
|
| 50 |
<p>
|
| 51 |
-
<strong>
|
| 52 |
</p>
|
| 53 |
|
| 54 |
<h2>1. Information We Collect</h2>
|
|
@@ -90,12 +90,17 @@
|
|
| 90 |
<p>These services operate under their own privacy policies. We do not share personally identifiable information with these services.</p>
|
| 91 |
|
| 92 |
<h2>4. Advertisements</h2>
|
|
|
|
| 93 |
|
| 94 |
<div class="note">
|
|
|
|
| 95 |
<p>The app does <strong>not</strong> display advertisements and does not use or share data with ad networks.</p>
|
| 96 |
</div>
|
| 97 |
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
<h2>5. Security</h2>
|
| 101 |
<p>We implement reasonable technical and organizational measures to protect data stored locally or transmitted from the app. However, no method of transmission or electronic storage is 100% secure. Your watchlist and any local data remain on your device unless you opt-in to cloud sync in a future version.</p>
|
|
@@ -109,12 +114,14 @@
|
|
| 109 |
<h2>8. Contact Us</h2>
|
| 110 |
<p>If you have questions about this Privacy Policy, please contact us:</p>
|
| 111 |
<ul>
|
| 112 |
-
<li><strong>Email:</strong> <a href="mailto:[YOUR EMAIL]">
|
| 113 |
-
<li><strong>Developer / Company:</strong>
|
| 114 |
</ul>
|
| 115 |
|
| 116 |
<footer>
|
|
|
|
| 117 |
</footer>
|
| 118 |
</div>
|
| 119 |
-
</body>
|
| 120 |
-
</html>
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="utf-8" />
|
| 5 |
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
| 6 |
+
<title>Privacy Policy — Stockistan</title>
|
| 7 |
<style>
|
| 8 |
:root{
|
| 9 |
--bg:#ffffff;
|
|
|
|
| 45 |
<body>
|
| 46 |
<div class="wrap" role="main">
|
| 47 |
<h1>Privacy Policy</h1>
|
| 48 |
+
<p class="muted"><strong>Stockistan</strong> — Last updated: <strong>[DATE]</strong></p>
|
| 49 |
|
| 50 |
<p>
|
| 51 |
+
<strong>Stockistan</strong> (“we”, “our”, or “the app”) provides Pakistan Stock Exchange (PSX) market data, watchlist functionality, and related market insights. Your privacy matters to us. This Privacy Policy explains what information we collect, how we use it, and the choices you have.
|
| 52 |
</p>
|
| 53 |
|
| 54 |
<h2>1. Information We Collect</h2>
|
|
|
|
| 90 |
<p>These services operate under their own privacy policies. We do not share personally identifiable information with these services.</p>
|
| 91 |
|
| 92 |
<h2>4. Advertisements</h2>
|
| 93 |
+
<p class="muted">If your app has no ads, remove this block or use the “no ads” variant below.</p>
|
| 94 |
|
| 95 |
<div class="note">
|
| 96 |
+
<strong>If your app does not display ads:</strong>
|
| 97 |
<p>The app does <strong>not</strong> display advertisements and does not use or share data with ad networks.</p>
|
| 98 |
</div>
|
| 99 |
|
| 100 |
+
<!-- If you DO use ads, replace the above block with the following and remove the .note -->
|
| 101 |
+
<!--
|
| 102 |
+
<p>The app may display third-party advertisements. Third-party ad networks may collect anonymous identifiers (for example, Advertising ID) to provide relevant ads. We do not provide any personal data to ad networks.</p>
|
| 103 |
+
-->
|
| 104 |
|
| 105 |
<h2>5. Security</h2>
|
| 106 |
<p>We implement reasonable technical and organizational measures to protect data stored locally or transmitted from the app. However, no method of transmission or electronic storage is 100% secure. Your watchlist and any local data remain on your device unless you opt-in to cloud sync in a future version.</p>
|
|
|
|
| 114 |
<h2>8. Contact Us</h2>
|
| 115 |
<p>If you have questions about this Privacy Policy, please contact us:</p>
|
| 116 |
<ul>
|
| 117 |
+
<li><strong>Email:</strong> <a href="mailto:[YOUR EMAIL]">[YOUR EMAIL]</a></li>
|
| 118 |
+
<li><strong>Developer / Company:</strong> [YOUR NAME / COMPANY]</li>
|
| 119 |
</ul>
|
| 120 |
|
| 121 |
<footer>
|
| 122 |
+
<p class="muted">This Privacy Policy was generated to help you comply with app store requirements. This document does not constitute legal advice. If your app collects additional personal data, implements analytics, advertising, payments, or cloud features, consider consulting a legal professional to ensure compliance with applicable laws (including GDPR, CCPA, or local Pakistani data protection laws) and store policies.</p>
|
| 123 |
</footer>
|
| 124 |
</div>
|
| 125 |
+
</body>
|
| 126 |
+
</html>
|
| 127 |
+
|