How to open the .wadl file for the doc.atlassian.com? - jira-rest-api

I download a .wadl file from https://docs.atlassian.com/software/jira/docs/api/REST/8.8.1/jira-rest-plugin.wadl
Do you know how to use it? Does it need to be imported by specific application?

You can import your .wadl file with Postman.
Click Import
Select your file or folder, input your link, or paste your raw text. Postman will automatically recognize Postman data.
Confirm the name, format, and what you would like your data to import as, then click Import to bring your data into Postman.
https://i.stack.imgur.com/WMrNE.png
https://i.stack.imgur.com/JYMmE.png

Related

How do you import a reference to a dart file when you only know the file name? Extension methods and others

To import a file in Dart (using IntelliJ) I will usually use start typing the name of a function, class or variable and select enter. Alternatively I might type the name of the class and press alt+enter on it. This will then give me an option to import the file reference.
For extension methods this doesn't work and sometimes I know the name of the package (file) I want to import but can't remember the name of the function.
Is there a way to use the filename to lookup and insert an import statement with the full package address?
Edit
Unfortunately my originally accepted answer doesn't always work. For example with extension methods. I'm trying to add a reference and it seems impossible to do without typing the full reference to the extension.
Edit2
Found out there is an open issue to fix this
https://github.com/dart-lang/sdk/issues/40365
You can write import 'som...' and ctrl+space for auto-complete and get IntelliJ to make suggestion across all packages imported with pubspec and files across the project. If the file is inside a package, it will automatically insert the full path.

Is that possible to import from different modules in google colaboratory?

I am using google colaboratory. I have a 'utils.ipynb' which contains some useful functions. For example:
load_image(path)
I have another 'models.ipynb' in which I want to use the codes in 'utils.ipynb'. How should I do that? For example, how can I import load_image from 'utils.ipynb'?
This code does not work by the way:
from utils import load_image
You can import from a .py file, not from a .ipynb file.
So,
copy the code in .ipynb into a text file and name it utils.py
upload utils.py to Google Colab
from utils import load_images

How to configure ZeroClipboard for pdf generation?

I am using Datatable Tools to export some table to PDF but I am getting error while exporting the data. The error says
This instance of ZeroClipboard is not configured for PDF export. Please use the PDF export version.
Anyone knows how I can configure ZeroClipboard.js so I can get PDF?
Any help would be appreciated!
Based on your question, I assume you have it working and its displayed properly on the DataTable. I had the same problem recently and the fix was fairly easy, all I had to do was change the location of the swf file to the PDF one. Below is an example.
"sDom": '<"clear">lfrtipT',
"oTableTools": {
"sSwfPath": "/js/DataTables-1.9.4/extras/TableTools-2.0.0/media/swf/copy_cvs_xls_pdf.swf"
}
Normally the default import is just "copy_cvs_xls.swf". The other file should be in the same location, check it out and import it instead.

python: from modules import abc.py does not work

I have recently switched from python 2.7 to python 3.2
considering following folder structure:
~/my_program
~/my_program/modules
where *my_program* is the root of the application, containing main script called main.py
*my_program/modules* is used to store all additional classes and subscripts
in python2.x I was able to import any file "module" the same way I do import standard modules
from modules import abc.py
however, while I try to launch the same program in python3.2 I get the error message saying:
File "/my_program/modules/__init__.py" line 1
import abc, def
ImportError: No module named abc
Please advise
It's a good example you are using, because "abc" is in fact a module in the standard library. So in fact, if you in Python 3 do import abc that will work just fine, but you will get the standard library module.
In Python 2, if you had a local module called abc.py, that import abc would import the local module instead. That means you couldn't import the module from the standard library.
In Python 3, this has been changed, and you now need to use the fully qualified name, in your case probably from modules import abc.
Where are you storing the module you created? When I create a module, I do the following:
Create a folder in the lib\sitepackages folder in your python folder ex: myModules
Save a blank python file named init.py in this folder. The file does not have to contain any syntax. Later on, you can set module requirements in this file if you wish.
Save your module into this folder ex: myGamesModule.py
In idle (or whichever python connected IDE you use) type:
from myModules import myGamesModule or from myModules import myGamesModule as myGmMod
That should import your module and then you can call the classes etc ex myGmMod.Player()
I am sure that this is correct, as I have just done it and it was ok.
I have found that sometimes, if I create a blank text file in the module folder and rename it to init.py, it has caused me problems before. I usually just open IDLE and save a init.py file from there into my module folder and then use whichever IDE I use (sublime) to create and save the rest of the files.
Also, for some reason, the text box has disallowed the underscores I am using in this text so where you see init.py, it should be (underscoreunderscore*init*underscoreunderscore.py without any asterix

Saving full page content using Selenium

I was wondering what's the best way to save all the files that are retrieved when Selenium visits a site. In other words, when Selenium visits http://www.google.com I want to save the HTML, JavaScript (including scripts referenced in src tags), images, and potentially content contained in iframes. How can this be done?
I know getHTMLSource() will return the HTML content in the body of the main frame, but how can this be extended to download the complete set of files necessary to render that page again.
Thanks in advance!
Selenium isn't the designed for this, you could either:
Use getHtmlSource and parse the resulting HTML for references to external files, which you can then download and store outside of Selenium.
Use something other than Selenium to download and store an offline version of a website - I'm sure there are plenty of tools that could do this if you do a search. For example WGet can perform a recursive download (http://en.wikipedia.org/wiki/Wget#Recursive_download)
Is there any reason you want to use Selenium? Is this part of your testing strategy or are you just wanting to find a tool that will create an offline copy of a page?
The only built in method Selenium has for downloading source content is
driver = webdriver.Chrome()
driver.get('www.someurl.com')
page_source = driver.page_source
But that doesn't download all the images, css, and js scripts like you would get if you used ctrl+s on a webpage. So you'll need to emulate the ctr+s keys after you navigate to a webpage like Algorithmatic has stated.
I made a gist to show how thats done. https://gist.github.com/GrilledChickenThighs/211c307edf8f828806c4bb4e4707b106
# Download entire webpage including all javascript, html, css of webpage. Replicates ctrl+s when on a webpage.
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
def save_current_page():
ActionChains(browser).send_keys(Keys.CONTROL, "s").perform()
A good tool for that is http://www.httrack.com/, Selenium doesn't provide any API for that. In case you need to save the full content of a page from your test case in selenium, perhaps you can execute httrack as a command line tool.
Thanks
If you really want to use Selenium then what you can do is emulate Ctrl+S for saving the page, but then it's more work/difficult (also OS dependent) to emulate pressing Enter or changing the location of where you want to save the webpage and its content.
I wanted to do the same thing with Selenium but realized that I could just use tools like wget, and I really didn't need to only use Selenium.. So I ended up using wget, it's really powerful and it does exactly what I need.
This is how you would do it using wget from a Python script:
import os
# Save HTML
directory = 'directory_to_save_webpage_content/'
url = 'http://www.google.com'
wget = "wget -p -k -P {} {}".format(directory, url)
os.system(wget)
The args passed are just to make it possible to view the page offline as if you're still online.
--page-requisites -p -- get all images needed to display page
--convert-links -k -- convert links to be relative
--directory-prefix -P -- specify prefix to save files to
I made this by downloading external sources (images) and replacing their src attribute.
Let's assume I want to save all images from <img> tags to the ../images path relative to the current page.
~/site
~/site/pages/
~/site/pages/page1.html
~/site/pages/page2.html
~/site/images/
~/site/images/img_for_page1.png
~/site/images/img_for_page2.png
I download the images with requests module.
# save_full_page.py
from selenium import webdriver
import requests
... # open page you want to save
with open("replace_img_srcs.js", 'r') as file:
replace_img_srcs_js = file.read()
save_dir = "/home/user/site"
save_to_file = "/home/user/site/pages/page1.html"
img_tags = driver.find_elements(By.TAG_NAME, "img")
for img_tag in img_tags:
img_src = img_tag.get_attribute("src")
r = requests.get(img_src, allow_redirects=True)
img_filename = img_src.rsplit('/', 1)[1]
open(save_dir + "/images/" + img_filename, 'wb').write(r.content)
driver.execute_script(replace_img_srcs_js) # see below
with open(save_to_file, 'w') as f:
f.write(driver.page_source)
This code edits the src attribute. I placed it to separate file to be able to see syntax highlighting. You can place the contents of it directly to the driver.execute_script(...) if you wish.
// replace_img_srcs.js
Array.prototype.slice.call(document.getElementsByTagName('img')).forEach(
function(item) {
var img_src = item.src;
var img_filename = img_src.replace(/^.*[\\\/]/, '');
var img_filename_urlencoded = encodeURIComponent(img_filename) // because images may be named with encoded symbols
item.src = item.src.replace(img_src, "../images/" + img_filename_urlencoded);
}
)
Now we have page saved for autonomous use.