Comments (5)
You should open file as wb
instead of w
wb
allows files to be opened for writing as binary
from atlassian-python-api.
You should open file as
wb
instead ofw
wb
allows files to be opened for writing as binary
Thanks for helping out, unfortunately, I am still getting a corrupted file...
from atlassian-python-api.
Quick check on this, I have tested the code and it is able to generate the pdf for me.
Possibly you need to first check if authentication is working correctly or not.
Sharing the code snippet which worked for me
from atlassian import Confluence
def save_file(content, title):
file_pdf = open(title + ".pdf", "wb")
file_pdf.write(content)
file_pdf.close()
print("Completed")
secret_key="<your_confluence_secret_key>"
label = "apitesting"
confluence = Confluence(
url='https://<your_confluence_url>',
token=secret_key)
pages = confluence.get_all_pages_by_label(label=label, start=0, limit=10)
for page in pages:
response = confluence.get_page_as_pdf(page["id"])
save_file(content=response, title=page["title"])
Also I have used adobe acrobat to verify the files
from atlassian-python-api.
label
I have a problem with the export API.
I did provide a token and I can successfully get page content etc., but export to pdf returns the HTML content of a login page.
Here's my code:
confluence = Confluence(
url='https://my.company.confluence/',
token=token)
page = confluence.get_page_by_id(11111, expand='body.storage') # WORKS WELL
print(page['title'])
response = confluence.get_page_as_pdf(68258487)
print(response) # PRINTS Login page content
from atlassian-python-api.
@frankiedrake It could be possible that your confluence API url is incorrect. thats why you are seeing Login page as HTML result.
Check with your administrator for correct url.
from atlassian-python-api.
Related Issues (20)
- [confluence] SSLerror and 401 HOT 2
- BUG: Documentation https://atlassian-python-api.readthedocs.io HOT 1
- API method to check if a user has permission on a specific page/space HOT 2
- get_page_as_word is giving data in bytes for .doc format and not .docx. Do we have any method to get .docx format HOT 1
- Is there any async implenetaton?
- confluence.get_space_permissions(space_key) gives 404 HOT 1
- Parsing date-time string for pipeline.completed_on failing due to strftime issue.
- Question: is python 2.7 still supported? HOT 1
- Question: Get all commits on a specific branch HOT 1
- Max of only 500 pages are returned HOT 3
- markdown app HOT 1
- Getting and setting default reviewers in Bitbucket Server
- Assets REST API HOT 3
- Path Variables instead of Query Params in URLs
- Comma in expand query param causes issue if URL encoded HOT 2
- need a function to set the test status in in test execution HOT 1
- Confluence Cloud Python API connection Timeouts
- Jira Software - rank API available? HOT 1
- [Jira] get_issue_changelog broken? HOT 2
- unexpected keyword argument 'paging_workaround' HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atlassian-python-api.