Skip to main content
# BasitApi [![Build Status](https://travis-ci.org/omerucel/basitapi.png)](https://travis-ci.org/omerucel/basitapi)

RESTful API oluşturmanızda size yardımcı olan basit bir kütüphane. Django'nun
sınıf temelli View yapısı üzerine kurulu. Bir RESTful API'de olması gereken
bazı temel özellikleri sunar ve başka da bir işe karışmaz.

Sunduğu bazı temel özellikler:

* *Bağlantıdaki method parametresi ile HTTP_METHOD başlığının ezilmesi.*

Bazı istemciler sadece bazı metodları göndermekle kısıtlandırılabilirler. Bu
türlü bir durumda API'nin doğru çalışabilmesi için bağlantı içinde *method*
isimli parametreyi kullanabilirsiniz. Bu parametre ile HTTP_METHOD ezilir ve
gönderdiğiniz method parametresindeki değere göre işlemler yürütülür.

* *Her zaman 200 HTTP kodu ile dönüş.*

Bazı istemciler sadece bazı hata kodlarına yanıt verebilirler. BasitApi bu tür durumlar için
*suppress_response_codes* parametresine destek vermekte. Bu parametre değeri
1 olarak gönderildiğinde durumu ne olursa olsun tüm yanıtlar 200 kodu ile
gönderilmekte.

* *Yanıt formatı.*

Hem *Accept* başlık bilgisine hem de bağlantı dosya son ekine göre yanıt
formatı ayarlanabilmekte.


## Kurulum

PyPi üzerinden kurulum için aşağıdaki komutu kullanabilirsiniz:

```
$ pip install basitapi
```

Github üzerinden kurulum için aşağıdaki komutu kullanabilirsiniz:

```
$ pip install -e git://github.com/omerucel/basitapi.git#egg=basitapi
```

## Kullanım

### settings.py

```python
INSTALLED_APPS=(
...
'basitapi'
)
```

### urls.py

Bağlantı dosya son ekine göre yanıt formatını ayarlamak istemiyorsanız
bağlantılarınızı *format_suffix_patterns* ile tekrar formatlamanıza gerek yok!

```python
from basitapi.urlpatterns import format_suffix_patterns
from appname.views import ViewName

urlpatterns = patterns(
url(r'^foo', ViewName.as_view()),
...
)

urlpatterns = format_suffix_patterns(urlpatterns)
```

### views.py

```python

from basitapi.exception import ApiException
from basitapi.response import ApiResponse
from basitapi.views import ApiView

class ViewName(ApiView):
def get(self, request):
return ApiResponse({
'result' : 'data'
})

def post(self, request):
raise ApiException('Bir hata olustu', status=403, application_code=1111)
```

Metadata

Release files for basitapi 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for basitapi 0.1.2
File Size Uploaded Provenance
basitapi-0.1.2.tar.gz 15.3 kB Without provenance Details

Release files / basitapi-0.1.2.tar.gz

Download URL basitapi-0.1.2.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4d0bfaa04cdb9575caddc22c4ff573b30f293504396c2716b7f1502909df0c70
BLAKE2b-256 checksum
How to use checksums
b0d49b65e561bd8f6c1ced8798d06af7320988325253888d9cfaee0f5d9f66d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for basitapi 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page