A simple multiprocessing google drive api
Project description
A simple package
from michiko import Drive
# NOTE: URI params must be strings not integers
gist_uri = 'https://api.github.com/gists{/gist_id}'
t = URITemplate(gist_uri)
print(t.expand(gist_id='123456'))
# => https://api.github.com/users/sigmavirus24/gists/123456
# or
print(expand(gist_uri, gist_id='123456'))
# also
t.expand({'gist_id': '123456'})
print(expand(gist_uri, {'gist_id': '123456'}))
Where it might be useful to have a class
import requests
class GitHubUser(object):
url = URITemplate('https://api.github.com/user{/login}')
def __init__(self, name):
self.api_url = url.expand(login=name)
response = requests.get(self.api_url)
if response.status_code == 200:
self.__dict__.update(response.json())
When the module containing this class is loaded, GitHubUser.url is evaluated and so the template is created once. It’s often hard to notice in Python, but object creation can consume a great deal of time and so can the re module which uritemplate relies on. Constructing the object once should reduce the amount of time your code takes to run.
Installing
pip install michiko
License
GPL license
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
michiko-0.0.4.tar.gz
(43.5 kB
view details)
Built Distribution
michiko-0.0.4-py3-none-any.whl
(30.7 kB
view details)
File details
Details for the file michiko-0.0.4.tar.gz
.
File metadata
- Download URL: michiko-0.0.4.tar.gz
- Upload date:
- Size: 43.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d1d0eb9e25adfa3ddb746bee771756e272d9cc1e7f7aebf644955551c4e2cdb |
|
MD5 | 57ff0f5ba9532868471675ed55e557d4 |
|
BLAKE2b-256 | 293a026344732a831eb9de1f2f5eaaccae4467bcd6ba2f2fcf4c2ae7a0328e0f |
File details
Details for the file michiko-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: michiko-0.0.4-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4d87de9c58a9987010aa140ce92ae5487dcd8da755f0646044bf43c7e536e81 |
|
MD5 | a3b03ec47b677648471c38e8918d0bba |
|
BLAKE2b-256 | 32888682a0d4d0f4a16c6932cb00c82efbdb7e6a56f3e7bd70f1081e78b7d0d4 |