capsarsiv 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.
- capsarsiv-0.1.0/.github/workflows/publish.yml +57 -0
- capsarsiv-0.1.0/.gitignore +33 -0
- capsarsiv-0.1.0/LICENSE +21 -0
- capsarsiv-0.1.0/PKG-INFO +172 -0
- capsarsiv-0.1.0/README.md +139 -0
- capsarsiv-0.1.0/capsarsiv/__init__.py +25 -0
- capsarsiv-0.1.0/capsarsiv/cli.py +291 -0
- capsarsiv-0.1.0/capsarsiv/client.py +219 -0
- capsarsiv-0.1.0/capsarsiv/exceptions.py +41 -0
- capsarsiv-0.1.0/capsarsiv/models.py +101 -0
- capsarsiv-0.1.0/capsarsiv.egg-info/PKG-INFO +172 -0
- capsarsiv-0.1.0/capsarsiv.egg-info/SOURCES.txt +20 -0
- capsarsiv-0.1.0/capsarsiv.egg-info/dependency_links.txt +1 -0
- capsarsiv-0.1.0/capsarsiv.egg-info/entry_points.txt +2 -0
- capsarsiv-0.1.0/capsarsiv.egg-info/requires.txt +8 -0
- capsarsiv-0.1.0/capsarsiv.egg-info/top_level.txt +1 -0
- capsarsiv-0.1.0/pyproject.toml +54 -0
- capsarsiv-0.1.0/setup.cfg +4 -0
- capsarsiv-0.1.0/tests/__init__.py +1 -0
- capsarsiv-0.1.0/tests/test_cli.py +151 -0
- capsarsiv-0.1.0/tests/test_client.py +197 -0
- capsarsiv-0.1.0/tests/test_models.py +94 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: Upload Python Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
name: Test
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: python -m pytest tests/ -v
|
|
31
|
+
|
|
32
|
+
publish:
|
|
33
|
+
name: Build & Publish
|
|
34
|
+
needs: test
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v4
|
|
39
|
+
|
|
40
|
+
- name: Set up Python
|
|
41
|
+
uses: actions/setup-python@v5
|
|
42
|
+
with:
|
|
43
|
+
python-version: "3.13"
|
|
44
|
+
|
|
45
|
+
- name: Install build tools
|
|
46
|
+
run: |
|
|
47
|
+
python -m pip install --upgrade pip
|
|
48
|
+
pip install build
|
|
49
|
+
|
|
50
|
+
- name: Build package
|
|
51
|
+
run: python -m build
|
|
52
|
+
|
|
53
|
+
- name: Publish to PyPI
|
|
54
|
+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
|
|
55
|
+
with:
|
|
56
|
+
user: __token__
|
|
57
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg-info/
|
|
7
|
+
*.egg
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
*.whl
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
env/
|
|
16
|
+
|
|
17
|
+
# IDE
|
|
18
|
+
.idea/
|
|
19
|
+
.vscode/
|
|
20
|
+
*.swp
|
|
21
|
+
*.swo
|
|
22
|
+
|
|
23
|
+
# OS
|
|
24
|
+
.DS_Store
|
|
25
|
+
Thumbs.db
|
|
26
|
+
|
|
27
|
+
# Environment
|
|
28
|
+
.env
|
|
29
|
+
|
|
30
|
+
# Testing
|
|
31
|
+
.pytest_cache/
|
|
32
|
+
.coverage
|
|
33
|
+
htmlcov/
|
capsarsiv-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Sinan Erdinç
|
|
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.
|
capsarsiv-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: capsarsiv
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Türkçe Caps Arşivi Python SDK ve CLI aracı
|
|
5
|
+
Author-email: Sinan Erdinç <sinanerdinc@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://capsarsiv.com
|
|
8
|
+
Project-URL: Repository, https://github.com/sinanerdinc/capsarsiv
|
|
9
|
+
Project-URL: Documentation, https://capsarsiv.com/developer
|
|
10
|
+
Project-URL: Issues, https://github.com/sinanerdinc/capsarsiv/issues
|
|
11
|
+
Keywords: caps,capsarsiv,türkçe,meme,cli,api
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: httpx>=0.27
|
|
26
|
+
Requires-Dist: click>=8.1
|
|
27
|
+
Requires-Dist: rich>=13.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-httpx>=0.30; extra == "dev"
|
|
31
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# capsarsiv
|
|
35
|
+
|
|
36
|
+
Türkçe Caps Arşivi Python SDK ve CLI aracı.
|
|
37
|
+
|
|
38
|
+
[](https://pypi.org/project/capsarsiv/)
|
|
39
|
+
[](https://pypi.org/project/capsarsiv/)
|
|
40
|
+
[](https://opensource.org/licenses/MIT)
|
|
41
|
+
|
|
42
|
+
[Türkçe Caps Arşivi](https://capsarsiv.com) API'sine erişmek için Python SDK ve komut satırı aracı.
|
|
43
|
+
|
|
44
|
+
## Kurulum
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install capsarsiv
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## API Key
|
|
51
|
+
|
|
52
|
+
API key almak için:
|
|
53
|
+
|
|
54
|
+
1. [capsarsiv.com/uyelik](https://capsarsiv.com/uyelik) sayfasından giriş yapın.
|
|
55
|
+
2. Hesap altındaki **developer API** bölümünde **API key oluştur**'a tıklayın.
|
|
56
|
+
3. Key yalnızca oluşturulduğu anda bir kez gösterilir; güvenli bir yerde saklayın.
|
|
57
|
+
|
|
58
|
+
Key'inizi ortam değişkeni olarak ayarlayın:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
export CAPSARSIV_API_KEY="senin_api_keyin"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Python SDK
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from capsarsiv import CapsArsiv
|
|
68
|
+
|
|
69
|
+
# Context manager ile kullanım (önerilir)
|
|
70
|
+
with CapsArsiv() as client:
|
|
71
|
+
# Capsleri listele
|
|
72
|
+
caps_list = client.caps(sort="popular", limit=10)
|
|
73
|
+
for c in caps_list:
|
|
74
|
+
print(f"{c.title} — puan: {c.score}")
|
|
75
|
+
|
|
76
|
+
# Arama yap
|
|
77
|
+
results = client.caps(q="futbol", sort="popular")
|
|
78
|
+
|
|
79
|
+
# Tag ile filtrele
|
|
80
|
+
spor_caps = client.caps(tag="spor", limit=5)
|
|
81
|
+
|
|
82
|
+
# Rastgele caps getir
|
|
83
|
+
rastgele = client.random()
|
|
84
|
+
print(f"Rastgele: {rastgele.title}")
|
|
85
|
+
|
|
86
|
+
# Slug ile detay getir
|
|
87
|
+
caps = client.get("ornek-caps")
|
|
88
|
+
print(caps.image_url)
|
|
89
|
+
|
|
90
|
+
# Tagleri listele
|
|
91
|
+
tags = client.tags(limit=20)
|
|
92
|
+
for t in tags:
|
|
93
|
+
print(f"#{t.name} ({t.count} caps)")
|
|
94
|
+
|
|
95
|
+
# Caps görselini indir
|
|
96
|
+
filepath = client.download("ornek-caps", directory="./caps")
|
|
97
|
+
print(f"İndirildi: {filepath}")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### API Key'i parametre olarak verme
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
client = CapsArsiv(api_key="senin_api_keyin")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## CLI Kullanımı
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Capsleri listele
|
|
110
|
+
capsarsiv caps
|
|
111
|
+
capsarsiv caps --sort popular --limit 10
|
|
112
|
+
capsarsiv caps --query futbol
|
|
113
|
+
capsarsiv caps --tag spor
|
|
114
|
+
|
|
115
|
+
# Rastgele caps
|
|
116
|
+
capsarsiv random
|
|
117
|
+
|
|
118
|
+
# Caps detayı
|
|
119
|
+
capsarsiv get ornek-caps
|
|
120
|
+
|
|
121
|
+
# Tagleri listele
|
|
122
|
+
capsarsiv tags
|
|
123
|
+
capsarsiv tags --limit 20
|
|
124
|
+
|
|
125
|
+
# Caps görselini indir
|
|
126
|
+
capsarsiv download ornek-caps
|
|
127
|
+
capsarsiv download ornek-caps -o ./caps/
|
|
128
|
+
|
|
129
|
+
# JSON çıktı
|
|
130
|
+
capsarsiv --json caps --limit 5
|
|
131
|
+
capsarsiv --json random
|
|
132
|
+
|
|
133
|
+
# Yardım
|
|
134
|
+
capsarsiv --help
|
|
135
|
+
capsarsiv caps --help
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### CLI ile API Key
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Ortam değişkeni (önerilir)
|
|
142
|
+
export CAPSARSIV_API_KEY="senin_api_keyin"
|
|
143
|
+
capsarsiv caps
|
|
144
|
+
|
|
145
|
+
# Parametre olarak
|
|
146
|
+
capsarsiv --api-key "senin_api_keyin" caps
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Hata Yönetimi
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from capsarsiv import CapsArsiv, NotFoundError, RateLimitError, AuthenticationError
|
|
153
|
+
|
|
154
|
+
with CapsArsiv() as client:
|
|
155
|
+
try:
|
|
156
|
+
caps = client.get("olmayan-caps")
|
|
157
|
+
except NotFoundError:
|
|
158
|
+
print("Caps bulunamadı!")
|
|
159
|
+
except RateLimitError:
|
|
160
|
+
print("İstek limiti aşıldı, lütfen bekleyin.")
|
|
161
|
+
except AuthenticationError:
|
|
162
|
+
print("API key geçersiz!")
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## API Limitleri
|
|
166
|
+
|
|
167
|
+
- Dakikada en fazla **60** istek
|
|
168
|
+
- Aylık **1000** istek (key başına)
|
|
169
|
+
|
|
170
|
+
## Lisans
|
|
171
|
+
|
|
172
|
+
MIT — detaylar için [LICENSE](LICENSE) dosyasına bakın.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# capsarsiv
|
|
2
|
+
|
|
3
|
+
Türkçe Caps Arşivi Python SDK ve CLI aracı.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/capsarsiv/)
|
|
6
|
+
[](https://pypi.org/project/capsarsiv/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
[Türkçe Caps Arşivi](https://capsarsiv.com) API'sine erişmek için Python SDK ve komut satırı aracı.
|
|
10
|
+
|
|
11
|
+
## Kurulum
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install capsarsiv
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## API Key
|
|
18
|
+
|
|
19
|
+
API key almak için:
|
|
20
|
+
|
|
21
|
+
1. [capsarsiv.com/uyelik](https://capsarsiv.com/uyelik) sayfasından giriş yapın.
|
|
22
|
+
2. Hesap altındaki **developer API** bölümünde **API key oluştur**'a tıklayın.
|
|
23
|
+
3. Key yalnızca oluşturulduğu anda bir kez gösterilir; güvenli bir yerde saklayın.
|
|
24
|
+
|
|
25
|
+
Key'inizi ortam değişkeni olarak ayarlayın:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
export CAPSARSIV_API_KEY="senin_api_keyin"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Python SDK
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from capsarsiv import CapsArsiv
|
|
35
|
+
|
|
36
|
+
# Context manager ile kullanım (önerilir)
|
|
37
|
+
with CapsArsiv() as client:
|
|
38
|
+
# Capsleri listele
|
|
39
|
+
caps_list = client.caps(sort="popular", limit=10)
|
|
40
|
+
for c in caps_list:
|
|
41
|
+
print(f"{c.title} — puan: {c.score}")
|
|
42
|
+
|
|
43
|
+
# Arama yap
|
|
44
|
+
results = client.caps(q="futbol", sort="popular")
|
|
45
|
+
|
|
46
|
+
# Tag ile filtrele
|
|
47
|
+
spor_caps = client.caps(tag="spor", limit=5)
|
|
48
|
+
|
|
49
|
+
# Rastgele caps getir
|
|
50
|
+
rastgele = client.random()
|
|
51
|
+
print(f"Rastgele: {rastgele.title}")
|
|
52
|
+
|
|
53
|
+
# Slug ile detay getir
|
|
54
|
+
caps = client.get("ornek-caps")
|
|
55
|
+
print(caps.image_url)
|
|
56
|
+
|
|
57
|
+
# Tagleri listele
|
|
58
|
+
tags = client.tags(limit=20)
|
|
59
|
+
for t in tags:
|
|
60
|
+
print(f"#{t.name} ({t.count} caps)")
|
|
61
|
+
|
|
62
|
+
# Caps görselini indir
|
|
63
|
+
filepath = client.download("ornek-caps", directory="./caps")
|
|
64
|
+
print(f"İndirildi: {filepath}")
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### API Key'i parametre olarak verme
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
client = CapsArsiv(api_key="senin_api_keyin")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## CLI Kullanımı
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Capsleri listele
|
|
77
|
+
capsarsiv caps
|
|
78
|
+
capsarsiv caps --sort popular --limit 10
|
|
79
|
+
capsarsiv caps --query futbol
|
|
80
|
+
capsarsiv caps --tag spor
|
|
81
|
+
|
|
82
|
+
# Rastgele caps
|
|
83
|
+
capsarsiv random
|
|
84
|
+
|
|
85
|
+
# Caps detayı
|
|
86
|
+
capsarsiv get ornek-caps
|
|
87
|
+
|
|
88
|
+
# Tagleri listele
|
|
89
|
+
capsarsiv tags
|
|
90
|
+
capsarsiv tags --limit 20
|
|
91
|
+
|
|
92
|
+
# Caps görselini indir
|
|
93
|
+
capsarsiv download ornek-caps
|
|
94
|
+
capsarsiv download ornek-caps -o ./caps/
|
|
95
|
+
|
|
96
|
+
# JSON çıktı
|
|
97
|
+
capsarsiv --json caps --limit 5
|
|
98
|
+
capsarsiv --json random
|
|
99
|
+
|
|
100
|
+
# Yardım
|
|
101
|
+
capsarsiv --help
|
|
102
|
+
capsarsiv caps --help
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### CLI ile API Key
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Ortam değişkeni (önerilir)
|
|
109
|
+
export CAPSARSIV_API_KEY="senin_api_keyin"
|
|
110
|
+
capsarsiv caps
|
|
111
|
+
|
|
112
|
+
# Parametre olarak
|
|
113
|
+
capsarsiv --api-key "senin_api_keyin" caps
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Hata Yönetimi
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from capsarsiv import CapsArsiv, NotFoundError, RateLimitError, AuthenticationError
|
|
120
|
+
|
|
121
|
+
with CapsArsiv() as client:
|
|
122
|
+
try:
|
|
123
|
+
caps = client.get("olmayan-caps")
|
|
124
|
+
except NotFoundError:
|
|
125
|
+
print("Caps bulunamadı!")
|
|
126
|
+
except RateLimitError:
|
|
127
|
+
print("İstek limiti aşıldı, lütfen bekleyin.")
|
|
128
|
+
except AuthenticationError:
|
|
129
|
+
print("API key geçersiz!")
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## API Limitleri
|
|
133
|
+
|
|
134
|
+
- Dakikada en fazla **60** istek
|
|
135
|
+
- Aylık **1000** istek (key başına)
|
|
136
|
+
|
|
137
|
+
## Lisans
|
|
138
|
+
|
|
139
|
+
MIT — detaylar için [LICENSE](LICENSE) dosyasına bakın.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Capsarsiv — Türkçe Caps Arşivi Python SDK ve CLI aracı."""
|
|
2
|
+
|
|
3
|
+
from capsarsiv.client import CapsArsiv
|
|
4
|
+
from capsarsiv.exceptions import (
|
|
5
|
+
APIError,
|
|
6
|
+
AuthenticationError,
|
|
7
|
+
CapsArsivError,
|
|
8
|
+
NotFoundError,
|
|
9
|
+
RateLimitError,
|
|
10
|
+
)
|
|
11
|
+
from capsarsiv.models import Caps, Tag
|
|
12
|
+
|
|
13
|
+
__version__ = "0.1.0"
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"CapsArsiv",
|
|
17
|
+
"Caps",
|
|
18
|
+
"Tag",
|
|
19
|
+
"CapsArsivError",
|
|
20
|
+
"AuthenticationError",
|
|
21
|
+
"NotFoundError",
|
|
22
|
+
"RateLimitError",
|
|
23
|
+
"APIError",
|
|
24
|
+
"__version__",
|
|
25
|
+
]
|