-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
138 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Build and Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "packages/client-py/**" | ||
|
||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
# NB: we use pyproject.toml so we can straight use the build command | ||
- run: python3 -m pip install --upgrade build twine | ||
- run: python3 -m build | ||
- run: python3 -m twine upload --repository pypi dist/* | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ node_modules | |
test | ||
dist | ||
.DS_Store | ||
.env | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__pycache__ | ||
**.egg-info |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .onedoc import Onedoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from onedoc import Onedoc | ||
from dotenv import load_dotenv | ||
from os import getenv | ||
|
||
load_dotenv() | ||
|
||
onedoc = Onedoc(getenv("ONEDOC_API_KEY")) | ||
|
||
# Define your document | ||
document = { | ||
"html": "<h1>Table of contents</h1><a href='file://test.pdf#page=1'>First page</a><br/><a href='file://test.pdf#page=2'>Second page</a>", # Simple HTML content | ||
"title": "My First Document", | ||
"test": True, # Set to False to use in production | ||
"save": False, # Set to True if you want to save the document | ||
} | ||
|
||
# Render the document | ||
#result = onedoc.render(document) | ||
|
||
#for files that are not saved, remember to use "wb" when writing file | ||
# onedoc = Onedoc(api_key) | ||
|
||
# # Define your document | ||
# document = { | ||
# "html": "<h1>Hello World</h1>", # Simple HTML content | ||
# "title": "My First Document", | ||
# "test": True, # Set to False to use in production | ||
# "save": False, # Set to True if you want to save the document | ||
# } | ||
|
||
# # Render the document | ||
# result = onedoc.render(document) | ||
# print(result.get("file")) | ||
# f = open("hellowordpierre.pdf", "wb") | ||
# f.write(result.get("file")) | ||
# f.close() | ||
|
||
# Store the result to toc.pdf | ||
#f = open("toc.pdf", "wb") | ||
#f.write(result.get("file")) | ||
#f.close() | ||
|
||
firstFile = open("toc.pdf", "rb") | ||
secondFile = open("test.pdf", "rb") | ||
|
||
result = onedoc.merge(firstFile, "toc.pdf", secondFile, "test.pdf") | ||
|
||
# Result is a pdf file | ||
f = open("merged.pdf", "wb") | ||
f.write(result.get('file')) | ||
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[project] | ||
name = "client_onedoc" | ||
version = "0.0.1" | ||
authors = [ | ||
{ name="Pierre Dorge", email="[email protected]" }, | ||
{ name="Titouan Launay", email="[email protected]" }, | ||
] | ||
description = "Onedoc SDK for Python" | ||
readme = "README.md" | ||
requires-python = ">=3.8" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/onedoclabs/onedoc" | ||
Issues = "https://github.com/OnedocLabs/onedoc/issues" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.