Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 780d0ac

Browse files
Initial Commit
0 parents  commit 780d0ac

File tree

18 files changed

+677
-0
lines changed

18 files changed

+677
-0
lines changed

.gitignore

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# PyRight Config
2+
pyrightconfig.json
3+
4+
# Byte-compiled / optimized / DLL files
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
9+
# C extensions
10+
*.so
11+
12+
# Distribution / packaging
13+
.Python
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
pip-wheel-metadata/
27+
share/python-wheels/
28+
*.egg-info/
29+
.installed.cfg
30+
*.egg
31+
MANIFEST
32+
33+
# PyInstaller
34+
# Usually these files are written by a python script from a template
35+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
36+
*.manifest
37+
*.spec
38+
39+
# Installer logs
40+
pip-log.txt
41+
pip-delete-this-directory.txt
42+
43+
# Unit test / coverage reports
44+
htmlcov/
45+
.tox/
46+
.nox/
47+
.coverage
48+
.coverage.*
49+
.cache
50+
nosetests.xml
51+
coverage.xml
52+
*.cover
53+
*.py,cover
54+
.hypothesis/
55+
.pytest_cache/
56+
57+
# Translations
58+
*.mo
59+
*.pot
60+
61+
# Django stuff:
62+
*.log
63+
local_settings.py
64+
db.sqlite3
65+
db.sqlite3-journal
66+
67+
# Flask stuff:
68+
instance/
69+
.webassets-cache
70+
71+
# Scrapy stuff:
72+
.scrapy
73+
74+
# Sphinx documentation
75+
docs/_build/
76+
77+
# PyBuilder
78+
target/
79+
80+
# Jupyter Notebook
81+
.ipynb_checkpoints
82+
83+
# IPython
84+
profile_default/
85+
ipython_config.py
86+
87+
# pyenv
88+
.python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
98+
__pypackages__/
99+
100+
# Celery stuff
101+
celerybeat-schedule
102+
celerybeat.pid
103+
104+
# SageMath parsed files
105+
*.sage.py
106+
107+
# Environments
108+
.env
109+
.venv
110+
env/
111+
venv/
112+
ENV/
113+
env.bak/
114+
venv.bak/
115+
116+
# Spyder project settings
117+
.spyderproject
118+
.spyproject
119+
120+
# Rope project settings
121+
.ropeproject
122+
123+
# mkdocs documentation
124+
/site
125+
126+
# mypy
127+
.mypy_cache/
128+
.dmypy.json
129+
dmypy.json
130+
131+
# Pyre type checker
132+
.pyre/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 OpenRobot
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.

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# OpenRobot API Wrapper
2+
Welcome to the official library of OpenRobot API Wrapper, in Python.
3+
4+
# Examples:
5+
Examples for both sync and async can be found in the examples directory.
6+
7+
# How to install:
8+
```sh
9+
$ pip install git+https://github.com/OpenRobot/Packages@API-Wrapper
10+
```
11+
Note: This might be different from yours.
12+
13+
# License:
14+
MIT

examples/async/celebrity.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from openrobot.api_wrapper import AsyncClient
2+
3+
client = AsyncClient(...)
4+
5+
celebrities = await client.celebrity(url=...) # List[openrobot.api_wrapper.results.CelebrityResult]
6+
7+
for celebrity in celebrities:
8+
celebrity # openrobot.api_wrapper.results.CelebrityResult

examples/async/lyrics.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from openrobot.api_wrapper import AsyncClient
2+
3+
client = AsyncClient(...)
4+
5+
lyrics = await client.lyrics("Never gonna give you up")
6+
7+
lyrics.title # Never gonna give you up
8+
lyrics.artist # ...
9+
lyrics.lyric

examples/async/ocr.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from openrobot.api_wrapper import AsyncClient
2+
3+
client = AsyncClient(...)
4+
5+
# From URL:
6+
ocr = await client.ocr(url=...)
7+
8+
# From bytes:
9+
from io import BytesIO
10+
ocr = await client.ocr(fp=BytesIO(...))
11+
12+
ocr.text # ...

examples/async/translate.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from openrobot.api_wrapper import AsyncClient
2+
3+
client = AsyncClient(...)
4+
5+
# List supported languages:
6+
await client.translate.languages() # Return a dict in a format of {'Language Name': 'Language Code'}
7+
8+
# Translate:
9+
translate = await client.translate(text=..., to_lang=..., from_lang=...) # from_lang param is Optional, it defaults to "auto".
10+
11+
translate.to # The language for the text to be translated to
12+
translate.text # The translated text
13+
translate.source # The original text's language
14+
translate.before # The original text

examples/sync/celebrity.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from openrobot.api_wrapper import SyncClient
2+
3+
client = SyncClient(...)
4+
5+
celebrities = client.celebrity(url=...) # List[openrobot.api_wrapper.results.CelebrityResult]
6+
7+
for celebrity in celebrities:
8+
celebrity # openrobot.api_wrapper.results.CelebrityResult

examples/sync/lyrics.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from openrobot.api_wrapper import SyncClient
2+
3+
client = SyncClient(...)
4+
5+
lyrics = client.lyrics("Never gonna give you up")
6+
7+
lyrics.title # Never gonna give you up
8+
lyrics.artist # ...
9+
lyrics.lyric

examples/sync/ocr.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from openrobot.api_wrapper import SyncClient
2+
3+
client = SyncClient(...)
4+
5+
# From URL:
6+
ocr = client.ocr(url=...)
7+
8+
# From bytes:
9+
from io import BytesIO
10+
ocr = client.ocr(fp=BytesIO(...))
11+
12+
ocr.text # ...

0 commit comments

Comments
 (0)