All Projects → lionheart → requests-cloudkit

lionheart / requests-cloudkit

Licence: Apache-2.0 license
Apple CloudKit Python library.

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to requests-cloudkit

Pycurl Requests
A Requests-compatible interface for PycURL.
Stars: ✭ 23 (-61.67%)
Mutual labels:  requests, python-requests
Proxy requests
a class that uses scraped proxies to make http GET/POST requests (Python requests)
Stars: ✭ 357 (+495%)
Mutual labels:  requests, python-requests
Geolocator-2
Learn how to find and work with locations in Django, the Yelp API, and Google Maps api.
Stars: ✭ 24 (-60%)
Mutual labels:  requests, python-requests
Requests3
Requests 3.0, for Humans and Machines, alike. 🤖
Stars: ✭ 813 (+1255%)
Mutual labels:  requests, python-requests
Requests
A simple, yet elegant, HTTP library.
Stars: ✭ 46,558 (+77496.67%)
Mutual labels:  requests, python-requests
gists
Methods for working with the GitHub Gist API. Node.js/JavaScript
Stars: ✭ 96 (+60%)
Mutual labels:  requests
angular-http-cache
Speed up your remote requests by automatically caching them on client and add support for offline navigation.
Stars: ✭ 25 (-58.33%)
Mutual labels:  requests
cpr
C++ Requests: Curl for People, a spiritual port of Python Requests.
Stars: ✭ 5,005 (+8241.67%)
Mutual labels:  requests
option chain analysis
NSE Nifty Option chain analysis on the web page.
Stars: ✭ 63 (+5%)
Mutual labels:  requests
htmx-talk-2021
Code examples and slides from my 2021 talk Server-Side is Dead! Long Live Server-Side (+ HTMX), presented at DjangoCon and Code Code Code
Stars: ✭ 18 (-70%)
Mutual labels:  requests
wc18-cli
An easy command line interface for the 2018 World Cup
Stars: ✭ 15 (-75%)
Mutual labels:  requests
Email-Crawler-Lead-Generator
This email crawler will visit all pages of a provided website and parse and save emails found to a csv file.
Stars: ✭ 47 (-21.67%)
Mutual labels:  requests
python-crawler
爬虫学习仓库,适合零基础的人学习,对新手比较友好
Stars: ✭ 37 (-38.33%)
Mutual labels:  requests
premeStock
Monitors for restocks
Stars: ✭ 53 (-11.67%)
Mutual labels:  requests
covid-19
Data ETL & Analysis on the global and Mexican datasets of the COVID-19 pandemic.
Stars: ✭ 14 (-76.67%)
Mutual labels:  requests
proxy ip pool
python编写的爬虫代理ip池
Stars: ✭ 18 (-70%)
Mutual labels:  requests
mkm-sdk
Python SDK for Magickartenmarkt API
Stars: ✭ 33 (-45%)
Mutual labels:  requests
weibo topic
微博话题关键词,个人微博采集, 微博博文一键删除 selenium获取cookie,requests处理
Stars: ✭ 28 (-53.33%)
Mutual labels:  requests
requestsR
R interface to Python requests module
Stars: ✭ 12 (-80%)
Mutual labels:  requests
crawler
requests+lxml爬虫,简单爬虫架构
Stars: ✭ 72 (+20%)
Mutual labels:  requests

CI Status Version

This project provides an authentication handler for Apple's CloudKit server-to-server API for the requests Python library. In English, this means that this library lets you interact with CloudKit with Python in a server environment. It just has two dependencies--requests and python-ecdsa--and lets you skip all of the dull and boring cryptographic signing steps when authenticating with CloudKit on your own. While the underlying code is pretty straightforward, there was no correct code sample available online that described how to do this--but now there is!

Installation

requests-cloudkit is available for download through the Python Package Index (PyPi). You can install it right away using pip or easy_install.

pip install requests-cloudkit

Usage

requests-cloudkit provides an authentication handler that can be passed directly to the requests library to authenticate requests to the CloudKit API. Before working with the CloudKit server-to-server API, you'll first need to follow Apple's instructions to generate a certificate and a server-to-server key (see Accessing CloudKit Using a Server-to-Server Key).

Once you have these values, just plug them into a CloudKitAuth object, which you can use with requests to interface with CloudKit. E.g.:

>>> import requests
>>> from requests_cloudkit import CloudKitAuth
>>> auth = CloudKitAuth(key_id=YOUR_KEY_ID, key_file_name=YOUR_PRIVATE_KEY_PATH)
>>> requests.get("https://api.apple-cloudkit.com/database/[version]/[container]/[environment]/public/zones/list", auth=auth)

Using Requests-CloudKit with RestMapper

requests-cloudkit can also be used with python-restmapper to integrate directly with the CloudKit API.

>>> CloudKit = restmapper.RestMapper("https://api.apple-cloudkit.com/database/[version]/[container]/[environment]/")

Instantiate a cloudkit instance using your CloudKit server-to-server key ID and provide the path to the private key file.

>>> cloudkit = CloudKit(auth=CloudKitAuth(key_id=YOUR_KEY_ID, key_file_name=YOUR_KEY_FILE))

Now, you can start making requests to the CloudKit API using a nice attribute syntax.

>>> response = cloudkit.public.zones.list()

The above will hit https://api.apple-cloudkit.com/database/[version]/[container]/[environment]/public/zones/list.

If you want to pass in body data for a POST, provide a single argument to the call to the API, and specify "POST" as the first attribute (note: this argument expects a str value, so if you want to pass JSON, use json.dumps to encode it into a string). I.e.

>>> cloudkit.POST.my.request(data)

Or:

>>> cloudkit.POST.my.request(json.dumps(json_payload))

For the full list of CloudKit Server-to-Server API capabilities, reference Apple's developer documentation.

Support

If you like this library, or need help implementing it, just send us an email: [email protected].

License License

Apache License, Version 2.0. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].