pykapfinance 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pykapfinance-0.1.0/LICENSE +21 -0
- pykapfinance-0.1.0/MANIFEST.in +5 -0
- pykapfinance-0.1.0/PKG-INFO +517 -0
- pykapfinance-0.1.0/README.md +485 -0
- pykapfinance-0.1.0/examples/advanced_monitoring.py +371 -0
- pykapfinance-0.1.0/examples/basic_usage.py +377 -0
- pykapfinance-0.1.0/examples/stock_analysis.py +235 -0
- pykapfinance-0.1.0/pykap/__init__.py +26 -0
- pykapfinance-0.1.0/pykap/client.py +481 -0
- pykapfinance-0.1.0/pykap/exceptions.py +39 -0
- pykapfinance-0.1.0/pykap/models.py +391 -0
- pykapfinance-0.1.0/pykapfinance.egg-info/PKG-INFO +517 -0
- pykapfinance-0.1.0/pykapfinance.egg-info/SOURCES.txt +18 -0
- pykapfinance-0.1.0/pykapfinance.egg-info/dependency_links.txt +1 -0
- pykapfinance-0.1.0/pykapfinance.egg-info/requires.txt +1 -0
- pykapfinance-0.1.0/pykapfinance.egg-info/top_level.txt +1 -0
- pykapfinance-0.1.0/pyproject.toml +36 -0
- pykapfinance-0.1.0/requirements.txt +1 -0
- pykapfinance-0.1.0/setup.cfg +4 -0
- pykapfinance-0.1.0/setup.py +42 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PyKAP Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pykapfinance
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client library for KAP (Kamuyu Aydınlatma Platformu) API
|
|
5
|
+
Home-page: https://github.com/cagrigungor/pykap
|
|
6
|
+
Author: Çağrı Güngör
|
|
7
|
+
Author-email: Çağrı Güngör <iletisim@cagrigor.com>
|
|
8
|
+
Project-URL: Homepage, https://github.com/cagrigungor/pykap
|
|
9
|
+
Project-URL: Bug Reports, https://github.com/cagrigungor/pykap/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/cagrigungor/pykap/blob/main/README.md
|
|
11
|
+
Project-URL: Source, https://github.com/cagrigungor/pykap
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
15
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Requires-Python: >=3.7
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: requests>=2.28.0
|
|
28
|
+
Dynamic: author
|
|
29
|
+
Dynamic: home-page
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
Dynamic: requires-python
|
|
32
|
+
|
|
33
|
+
# PyKAP - Python KAP API Kütüphanesi
|
|
34
|
+
|
|
35
|
+
PyKAP, Türkiye'nin Kamuyu Aydınlatma Platformu (KAP) API'si için kapsamlı bir Python istemci kütüphanesidir.
|
|
36
|
+
|
|
37
|
+
## 🚀 Özellikler
|
|
38
|
+
|
|
39
|
+
PyKAP, KAP API'sinin tüm servislerini destekler:
|
|
40
|
+
|
|
41
|
+
- ✅ **Token Yönetimi**: Otomatik token oluşturma ve yenileme
|
|
42
|
+
- 📰 **Bildirim Servisleri**: Bildirimleri listeleme, detay görüntüleme, ek dosya indirme
|
|
43
|
+
- 🏢 **Şirket Bilgileri**: Şirket listesi, detayları ve menkul kıymet bilgileri
|
|
44
|
+
- 💰 **Fon Bilgileri**: Fon listesi ve detaylı fon bilgileri
|
|
45
|
+
- 🔒 **Bloklanmış Bildirimler**: Erişime kapatılmış bildirimleri görüntüleme
|
|
46
|
+
- 📊 **Hak Kullanım**: Kurumsal işlem süreç durumları
|
|
47
|
+
- 🔍 **Gelişmiş Arama**: Şirket koduna göre arama ve filtreleme
|
|
48
|
+
|
|
49
|
+
## 📦 Kurulum
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install -r requirements.txt
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Geliştirme kurulumu için:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install -e .
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 🎯 Hızlı Başlangıç
|
|
62
|
+
|
|
63
|
+
### Temel Kullanım
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from pykap import KAPClient
|
|
67
|
+
|
|
68
|
+
# Test ortamı için istemci oluşturma (varsayılan API key ile)
|
|
69
|
+
client = KAPClient(test_mode=True)
|
|
70
|
+
|
|
71
|
+
# Şirket listesini alma
|
|
72
|
+
companies = client.get_members()
|
|
73
|
+
print(f"Toplam {len(companies)} şirket bulundu")
|
|
74
|
+
|
|
75
|
+
# Son bildirim indeksini öğrenme
|
|
76
|
+
last_index = client.get_last_disclosure_index()
|
|
77
|
+
print(f"Son bildirim indeksi: {last_index}")
|
|
78
|
+
|
|
79
|
+
# Bildirimleri listeleme
|
|
80
|
+
disclosures = client.get_disclosures(
|
|
81
|
+
disclosure_index=last_index - 50,
|
|
82
|
+
disclosure_type="ODA" # Özel Durum Açıklamaları
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
for disclosure in disclosures:
|
|
86
|
+
print(f"{disclosure.title} - {disclosure.disclosure_index}")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Kendi API Anahtarlarınızı Kullanma
|
|
90
|
+
|
|
91
|
+
Kendi API key ve secret bilgilerinizle:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from pykap import KAPClient
|
|
95
|
+
|
|
96
|
+
# Özel API anahtarları ile
|
|
97
|
+
client = KAPClient(
|
|
98
|
+
test_mode=True,
|
|
99
|
+
api_key="your-api-key-here",
|
|
100
|
+
api_secret="your-api-secret-here"
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
# Ya da config dosyasından
|
|
104
|
+
from config import API_KEY, API_SECRET
|
|
105
|
+
|
|
106
|
+
client = KAPClient(
|
|
107
|
+
test_mode=True,
|
|
108
|
+
api_key=API_KEY,
|
|
109
|
+
api_secret=API_SECRET
|
|
110
|
+
)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Üretim Ortamı Kullanımı
|
|
114
|
+
|
|
115
|
+
Üretim ortamında token gereklidir:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
# Üretim ortamı için istemci
|
|
119
|
+
client = KAPClient(
|
|
120
|
+
test_mode=False,
|
|
121
|
+
api_key="your-api-key",
|
|
122
|
+
api_secret="your-api-secret",
|
|
123
|
+
auto_refresh_token=True
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
# Token otomatik olarak oluşturulur ve yenilenir
|
|
127
|
+
# Manuel token oluşturmak için:
|
|
128
|
+
token = client.generate_token()
|
|
129
|
+
print(f"Token: {token}")
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Bildirim Detayı ve Ek İndirme
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
# Bildirim detayını alma
|
|
136
|
+
detail = client.get_disclosure_detail(
|
|
137
|
+
disclosure_index=1211180,
|
|
138
|
+
file_type="data" # 'html' veya 'data'
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
print(f"Konu: {detail.subject.tr}")
|
|
142
|
+
print(f"Özet: {detail.summary.tr}")
|
|
143
|
+
print(f"Yayın Zamanı: {detail.time}")
|
|
144
|
+
|
|
145
|
+
# Ek dosyaları indirme
|
|
146
|
+
if detail.attachment_urls:
|
|
147
|
+
for attachment in detail.attachment_urls:
|
|
148
|
+
print(f"İndiriliyor: {attachment.file_name}")
|
|
149
|
+
|
|
150
|
+
# URL'den attachment ID'yi çıkar
|
|
151
|
+
attachment_id = attachment.url.split('/')[-1]
|
|
152
|
+
file_content = client.download_attachment(attachment_id)
|
|
153
|
+
|
|
154
|
+
# Dosyayı kaydet
|
|
155
|
+
with open(attachment.file_name, 'wb') as f:
|
|
156
|
+
f.write(file_content)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Şirket Bilgileri
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
# Hisse koduna göre şirket bulma
|
|
163
|
+
company = client.get_company_by_stock_code("THYAO")
|
|
164
|
+
if company:
|
|
165
|
+
print(f"Şirket: {company.title}")
|
|
166
|
+
print(f"ID: {company.id}")
|
|
167
|
+
print(f"Tip: {company.member_type}")
|
|
168
|
+
|
|
169
|
+
# Şirket detaylarını alma
|
|
170
|
+
detail = client.get_member_detail(company.id)
|
|
171
|
+
print(detail)
|
|
172
|
+
|
|
173
|
+
# Şirketlerin menkul kıymet bilgileri
|
|
174
|
+
securities = client.get_member_securities()
|
|
175
|
+
for item in securities[:5]:
|
|
176
|
+
print(f"{item.member.sirket_unvan}:")
|
|
177
|
+
for security in item.securities:
|
|
178
|
+
print(f" - {security.isin_desc} ({security.borsa_kodu})")
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Belirli Bir Şirkete Ait Bildirimleri Arama
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
# Şirket bildirimlerini arama
|
|
185
|
+
company = client.get_company_by_stock_code("THYAO")
|
|
186
|
+
if company:
|
|
187
|
+
disclosures = client.search_disclosures_by_company(
|
|
188
|
+
company_id=company.id,
|
|
189
|
+
disclosure_type="ODA"
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
for disclosure in disclosures[:10]:
|
|
193
|
+
print(f"{disclosure.title}")
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Fon Bilgileri
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
# Aktif fonları listeleme
|
|
200
|
+
funds = client.get_funds(fund_state=["Y"]) # Y=Aktif
|
|
201
|
+
|
|
202
|
+
for fund in funds[:10]:
|
|
203
|
+
print(f"{fund.fund_name} ({fund.fund_code})")
|
|
204
|
+
print(f" Tip: {fund.fund_type}")
|
|
205
|
+
print(f" Durum: {fund.fund_state}")
|
|
206
|
+
|
|
207
|
+
# Fon detayı
|
|
208
|
+
fund_detail = client.get_fund_detail(fund_id=4282)
|
|
209
|
+
print(fund_detail)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Bloklanmış Bildirimler
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
# Erişime kapatılmış bildirimleri listeleme
|
|
216
|
+
blocked = client.get_blocked_disclosures()
|
|
217
|
+
|
|
218
|
+
for item in blocked:
|
|
219
|
+
print(f"Bildirim ID: {item.disclosure_index}")
|
|
220
|
+
print(f"Tip: {item.blocked_type}")
|
|
221
|
+
print(f"Neden: {item.is_blocked_description_tr}")
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Hak Kullanım Süreç Durumu
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
# Kurumsal işlem durumlarını sorgulama
|
|
228
|
+
statuses = client.get_ca_event_status(process_ref_ids=[12941, 13214])
|
|
229
|
+
|
|
230
|
+
for status in statuses:
|
|
231
|
+
print(f"Süreç ID: {status.ref_id}")
|
|
232
|
+
print(f"Durum: {status.status_text}")
|
|
233
|
+
if status.complete_date:
|
|
234
|
+
print(f"Tamamlanma: {status.complete_date}")
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Context Manager Kullanımı
|
|
238
|
+
|
|
239
|
+
```python
|
|
240
|
+
# Otomatik kaynak yönetimi
|
|
241
|
+
with KAPClient(test_mode=True) as client:
|
|
242
|
+
companies = client.get_members()
|
|
243
|
+
print(f"{len(companies)} şirket bulundu")
|
|
244
|
+
# Client otomatik olarak kapatılır
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## 📚 Bildirim Tipleri ve Sınıfları
|
|
248
|
+
|
|
249
|
+
### Bildirim Sınıfları (DisclosureClass)
|
|
250
|
+
|
|
251
|
+
```python
|
|
252
|
+
from pykap.models import DisclosureClass
|
|
253
|
+
|
|
254
|
+
# FR - Finansal Rapor Bildirimi
|
|
255
|
+
# ODA - Özel Durum Açıklaması Bildirimi
|
|
256
|
+
# DG - Diğer Bildirim
|
|
257
|
+
# DUY - Düzenleyici Kurum Bildirimi
|
|
258
|
+
|
|
259
|
+
disclosures = client.get_disclosures(
|
|
260
|
+
disclosure_index=1000000,
|
|
261
|
+
disclosure_class=DisclosureClass.FR
|
|
262
|
+
)
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Bildirim Tipleri (DisclosureType)
|
|
266
|
+
|
|
267
|
+
```python
|
|
268
|
+
from pykap.models import DisclosureType
|
|
269
|
+
|
|
270
|
+
# FR - Finansal Rapor
|
|
271
|
+
# ODA - Özel Durum Açıklaması
|
|
272
|
+
# DG - Diğer
|
|
273
|
+
# DUY - Düzenleyici Kurum
|
|
274
|
+
# FON - Fon Bildirimi
|
|
275
|
+
# CA - Hak Kullanım Bildirimi
|
|
276
|
+
|
|
277
|
+
disclosures = client.get_disclosures(
|
|
278
|
+
disclosure_index=1000000,
|
|
279
|
+
disclosure_type=DisclosureType.ODA
|
|
280
|
+
)
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Şirket Tipleri (MemberType)
|
|
284
|
+
|
|
285
|
+
```python
|
|
286
|
+
from pykap.models import MemberType
|
|
287
|
+
|
|
288
|
+
# IGS - İşlem Gören Şirket
|
|
289
|
+
# IGMS - İşlem Görmeyen Şirket
|
|
290
|
+
# YK - Yatırım Kuruluşu
|
|
291
|
+
# PYS - Portföy Yönetim Şirketi
|
|
292
|
+
# FK - Fon Kurucu
|
|
293
|
+
# Ve daha fazlası...
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## 🔧 Gelişmiş Kullanım
|
|
297
|
+
|
|
298
|
+
### Özel Filtreleme
|
|
299
|
+
|
|
300
|
+
```python
|
|
301
|
+
# Belirli bir dönem için bildirimleri alma
|
|
302
|
+
start_index = 1200000
|
|
303
|
+
end_index = 1200100
|
|
304
|
+
|
|
305
|
+
all_disclosures = []
|
|
306
|
+
current_index = start_index
|
|
307
|
+
|
|
308
|
+
while current_index < end_index:
|
|
309
|
+
batch = client.get_disclosures(
|
|
310
|
+
disclosure_index=current_index,
|
|
311
|
+
disclosure_class="FR"
|
|
312
|
+
)
|
|
313
|
+
all_disclosures.extend(batch)
|
|
314
|
+
|
|
315
|
+
if batch:
|
|
316
|
+
# Sonraki batch için index güncelle
|
|
317
|
+
current_index = int(batch[-1].disclosure_index) + 1
|
|
318
|
+
else:
|
|
319
|
+
break
|
|
320
|
+
|
|
321
|
+
print(f"Toplam {len(all_disclosures)} bildirim bulundu")
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Hata Yönetimi
|
|
325
|
+
|
|
326
|
+
```python
|
|
327
|
+
from pykap.exceptions import (
|
|
328
|
+
KAPAuthenticationError,
|
|
329
|
+
KAPAPIError,
|
|
330
|
+
KAPValidationError
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
try:
|
|
334
|
+
# Geçersiz index
|
|
335
|
+
disclosures = client.get_disclosures(disclosure_index=100)
|
|
336
|
+
|
|
337
|
+
except KAPValidationError as e:
|
|
338
|
+
print(f"Geçersiz parametre: {e}")
|
|
339
|
+
|
|
340
|
+
except KAPAuthenticationError as e:
|
|
341
|
+
print(f"Kimlik doğrulama hatası: {e}")
|
|
342
|
+
|
|
343
|
+
except KAPAPIError as e:
|
|
344
|
+
print(f"API Hatası: {e}")
|
|
345
|
+
print(f"Hata Kodu: {e.error_code}")
|
|
346
|
+
print(f"HTTP Durum: {e.status_code}")
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## 📖 API Referansı
|
|
350
|
+
|
|
351
|
+
### KAPClient Metodları
|
|
352
|
+
|
|
353
|
+
#### Token Yönetimi
|
|
354
|
+
- `generate_token()` - Yeni token oluştur (üretim ortamı)
|
|
355
|
+
|
|
356
|
+
#### Bildirim Servisleri
|
|
357
|
+
- `get_disclosures(disclosure_index, disclosure_type, disclosure_class, company_id)` - Bildirim listesi
|
|
358
|
+
- `get_disclosure_detail(disclosure_index, file_type, sub_report_list)` - Bildirim detayı
|
|
359
|
+
- `download_attachment(attachment_id)` - Ek dosya indir
|
|
360
|
+
- `get_last_disclosure_index()` - Son bildirim indeksi
|
|
361
|
+
|
|
362
|
+
#### Şirket Servisleri
|
|
363
|
+
- `get_members()` - Tüm şirketler
|
|
364
|
+
- `get_member_detail(member_id)` - Şirket detayı
|
|
365
|
+
- `get_member_securities()` - Menkul kıymet bilgileri
|
|
366
|
+
- `get_company_by_stock_code(stock_code)` - Hisse koduna göre şirket bul
|
|
367
|
+
|
|
368
|
+
#### Fon Servisleri
|
|
369
|
+
- `get_funds(fund_state, fund_class, fund_type)` - Fon listesi
|
|
370
|
+
- `get_fund_detail(fund_id)` - Fon detayı
|
|
371
|
+
|
|
372
|
+
#### Diğer Servisler
|
|
373
|
+
- `get_blocked_disclosures()` - Bloklanmış bildirimler
|
|
374
|
+
- `get_ca_event_status(process_ref_ids)` - Hak kullanım durumu
|
|
375
|
+
- `search_disclosures_by_company(company_id, start_index, disclosure_type)` - Şirket bildirimlerini ara
|
|
376
|
+
|
|
377
|
+
## 🏗️ Proje Yapısı
|
|
378
|
+
|
|
379
|
+
```
|
|
380
|
+
pykap/
|
|
381
|
+
├── pykap/
|
|
382
|
+
│ ├── __init__.py # Paket başlatma
|
|
383
|
+
│ ├── client.py # Ana API istemcisi
|
|
384
|
+
│ ├── models.py # Veri modelleri
|
|
385
|
+
│ └── exceptions.py # Özel hatalar
|
|
386
|
+
├── examples/
|
|
387
|
+
│ └── basic_usage.py # Kullanım örnekleri
|
|
388
|
+
├── setup.py # Kurulum dosyası
|
|
389
|
+
├── requirements.txt # Bağımlılıklar
|
|
390
|
+
├── README.md # Bu dosya
|
|
391
|
+
└── LICENSE # Lisans
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## 🔐 Kimlik Doğrulama
|
|
395
|
+
|
|
396
|
+
### API Anahtarları
|
|
397
|
+
|
|
398
|
+
Kendi API anahtarlarınızı kullanmak için:
|
|
399
|
+
|
|
400
|
+
1. **config.py dosyasını düzenleyin:**
|
|
401
|
+
```python
|
|
402
|
+
API_KEY = "sizin-api-key-buraya"
|
|
403
|
+
API_SECRET = "sizin-api-secret-buraya"
|
|
404
|
+
TEST_MODE = True
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
2. **Doğrudan kod içinde kullanın:**
|
|
408
|
+
```python
|
|
409
|
+
client = KAPClient(
|
|
410
|
+
test_mode=True,
|
|
411
|
+
api_key="your-api-key",
|
|
412
|
+
api_secret="your-api-secret"
|
|
413
|
+
)
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Test Ortamı
|
|
417
|
+
Test ortamında kimlik doğrulama gerekmez (API key ile):
|
|
418
|
+
|
|
419
|
+
```python
|
|
420
|
+
client = KAPClient(
|
|
421
|
+
test_mode=True,
|
|
422
|
+
api_key="your-test-api-key"
|
|
423
|
+
)
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### Üretim Ortamı
|
|
427
|
+
Üretim ortamında API Key ile token alınmalıdır:
|
|
428
|
+
|
|
429
|
+
```python
|
|
430
|
+
client = KAPClient(
|
|
431
|
+
test_mode=False,
|
|
432
|
+
api_key="your-production-api-key",
|
|
433
|
+
auto_refresh_token=True
|
|
434
|
+
)
|
|
435
|
+
# Token otomatik olarak yönetilir (24 saat geçerli)
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### Varsayılan API Key
|
|
439
|
+
|
|
440
|
+
API Key belirtilmezse, kütüphane varsayılan değeri kullanır:
|
|
441
|
+
- Varsayılan: `29223dec-32bc-49fb-919f-51405d110ab2`
|
|
442
|
+
|
|
443
|
+
## ⚠️ Önemli Notlar
|
|
444
|
+
|
|
445
|
+
1. **Bildirim İndeksi**: disclosureIndex 538004'ten başlar. 84196-538004 arası KAP 4.0 öncesi verilerdir.
|
|
446
|
+
|
|
447
|
+
2. **Token Süresi**: Üretim ortamında token 24 saat geçerlidir. `auto_refresh_token=True` ile otomatik yenilenir.
|
|
448
|
+
|
|
449
|
+
3. **Erişime Kapatılmış Bildirimler**: KVKK nedeniyle bazı bildirimler erişime kapatılmıştır. `get_blocked_disclosures()` ile listelenebilir.
|
|
450
|
+
|
|
451
|
+
4. **Rate Limiting**: API'ye aşırı istek göndermekten kaçının.
|
|
452
|
+
|
|
453
|
+
5. **Veri Güncelliği**: API üzerinden alınan veriler geçmiş tarihli canlı ortam verileridir ve güncel durumdan farklılık gösterebilir.
|
|
454
|
+
|
|
455
|
+
## 🤝 Katkıda Bulunma
|
|
456
|
+
|
|
457
|
+
Katkılar memnuniyetle karşılanır! Lütfen:
|
|
458
|
+
|
|
459
|
+
1. Fork yapın
|
|
460
|
+
2. Feature branch oluşturun (`git checkout -b feature/amazing-feature`)
|
|
461
|
+
3. Değişikliklerinizi commit edin (`git commit -m 'Add amazing feature'`)
|
|
462
|
+
4. Branch'inizi push edin (`git push origin feature/amazing-feature`)
|
|
463
|
+
5. Pull Request oluşturun
|
|
464
|
+
|
|
465
|
+
## 📝 Lisans
|
|
466
|
+
|
|
467
|
+
Bu proje MIT lisansı altında lisanslanmıştır - detaylar için [LICENSE](LICENSE) dosyasına bakın.
|
|
468
|
+
|
|
469
|
+
## 📞 İletişim
|
|
470
|
+
|
|
471
|
+
- **KAP Destek**: kapdestek@mkk.com.tr
|
|
472
|
+
- **KAP İletişim**: https://www.mkk.com.tr/iletisim-formu
|
|
473
|
+
- **Sorumlu Kurum**: Kamuyu Aydınlatma Hizmetleri Direktörlüğü
|
|
474
|
+
|
|
475
|
+
## 🔗 Faydalı Bağlantılar
|
|
476
|
+
|
|
477
|
+
- [KAP Resmi Sitesi](https://www.kap.org.tr)
|
|
478
|
+
- [KAP API Dokümantasyonu](https://apigwdev.mkk.com.tr)
|
|
479
|
+
- [MKK Resmi Sitesi](https://www.mkk.com.tr)
|
|
480
|
+
|
|
481
|
+
## 📊 Hata Kodları
|
|
482
|
+
|
|
483
|
+
| Kod | Açıklama |
|
|
484
|
+
|-----|----------|
|
|
485
|
+
| ER001 | Servis erişim yetkiniz bulunmamaktadır |
|
|
486
|
+
| ER002 | Unauthorized request |
|
|
487
|
+
| ER003 | Tanımlı olmayan IP adresinden erişim |
|
|
488
|
+
| ER004 | Token geçersiz |
|
|
489
|
+
| ER005 | IP bilgisi doğrulanamadı |
|
|
490
|
+
| ER006 | Geçersiz token |
|
|
491
|
+
| ER007 | Token bilgisi doğrulanamadı |
|
|
492
|
+
| ER008 | Authorization token is not valid |
|
|
493
|
+
|
|
494
|
+
## 🎓 Örnekler
|
|
495
|
+
|
|
496
|
+
Daha fazla örnek için [examples](examples/) klasörüne bakın.
|
|
497
|
+
|
|
498
|
+
## ⚡ Performans İpuçları
|
|
499
|
+
|
|
500
|
+
1. Test ortamını geliştirme için kullanın
|
|
501
|
+
2. Toplu sorgularda sayfalama kullanın
|
|
502
|
+
3. Token'ı önbelleğe alın (üretimde)
|
|
503
|
+
4. Context manager kullanın
|
|
504
|
+
5. Gereksiz detay sorgularından kaçının
|
|
505
|
+
|
|
506
|
+
## 🔄 Sürüm Geçmişi
|
|
507
|
+
|
|
508
|
+
### v1.0.0 (2026-01-22)
|
|
509
|
+
- İlk sürüm
|
|
510
|
+
- Tüm KAP API servisleri destekleniyor
|
|
511
|
+
- Test ve üretim ortamı desteği
|
|
512
|
+
- Otomatik token yönetimi
|
|
513
|
+
- Kapsamlı hata yönetimi
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
**Not**: Bu kütüphane resmi bir KAP/MKK ürünü değildir. Bağımsız bir açık kaynak projesidir.
|