Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I got an email for verification . http://xyz.pythonanywhere.com/record/upload/f690928d034d27ebb943b3f9bc9e3ae9/12. How is the string f6909..... Generated and is there a way to find out the pattern ? Is there any function which is generating the random string for different email addresses ?
For best practices for generating URL-safe text strings you should look into pythons secrets module. Specifically the secrets.token_urlsafe([nbytes=None]) function which generates the string randomly. If properly generated the string should be almost impossible to predict or guess.
Here is the usage example for generating a hard-to-guess temporary URL containing a security token suitable for password recovery applications:
import secrets
url = 'https://example.com/reset=' + secrets.token_urlsafe()
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 months ago.
Improve this question
I'm learning Python and looking at the smtplib module.
I have seen several code examples, and many have smtplib.ehlo() or smtplib.helo()
What do they mean? What are they for?
You really need to read the RFC that defines SMTP, which is https://datatracker.ietf.org/doc/html/rfc5321 . HELO was the original introductory command (in RFC 821, in 1982!). Eventually, extensions were added that were not backward compatible. To say that you wanted to use the extension, you'd use EHLO. EHLO is now recommended for every SMTP transaction.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
My question is about Python code to consume existing REST APIs. The script is based on requests.
Let say, we have the following base URL:
www.something.com/search/countries/{country_code}/cities/{city_code}/
In order to ignore URL Encoding we assume that codes are numeric.
It seems that format is a perfect method to replace "place holders" with actual values.
URL.format(country_code = ..., city_code-... )
Is this pythonic enough?
I think that .format is a perfectly fine way to do that, but it's not super readable. You can use Python f-strings to make that more readable like:
country_code = 'foo'
city_code = 'bar'
url = f'www.something.com/search/countries/{country_code}/cities/{city_code}/'
The f will tell Python to interpolate the values inside the curly brackets with the variables defined above.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am looking for a way to generate random data for testing purposes (around 10000 files). For this testing I have a json schema.
Generation JSchema:
RunTest(){
JSchemaGenerator generator = new JSchemaGenerator();
JSchema schemaBuilding = generator.Generate(typeof(TestClass));
}
The code itself is in C# so ideally I would have a C# code for doing this, though a python solution is also accaptable. I have found a number of questions on this topic that got websites or only focusses on a single prefixed sample but I can't find how to do this in C# (or less preferably python), anybody got any good way of doing this?
As for the reason for doing this: it's two fold: 1 this tests the stability of the system by entering a lot of random data looking for edge cases we haven't thought of and 2 it's a load test. (so basically a smoke+load test)
In Oxygen Developer there is a tool that allows you to generate random JSON files from a JSON Schema, but you need to do this manually from an interface. The action can be found in the Tools menu and it opens a dialog box where you can configure various options for generating the JSON instances.
You can find more details in the user manual: https://www.oxygenxml.com/doc/versions/23.0/ug-editor/topics/json-schema-instance-generator-2.html
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
What's a simple and performat way to save online published lists of IP addresses like this one in a standard python list? Example
ip_list = ['109.70.100.20','185.165.168.229','51.79.86.174']
HTML parsing library beautifulsoap seems way to sophisticated for the simple structure.
Its not that beautifulsoup is too sophisticated, its that the content type is text, not html. There are several APIs for downloading content, and requests is popular. If you use its text property, it will perform any decoding and unzipping needed
import requests
resp = requests.get("https://www.dan.me.uk/torlist/")
ip_list = resp.text.split()
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have a keyword:
Verify Payment Method Field
Element Text Should Be ${paymentMethodValueField} PDF-lasku sähköpostiin
here is the logs:
Step 3 Fields verification :: OK: Display Customer Information fie... | FAIL |
The text of element '//div/span' should have been 'PDF-lasku s?hk?postiin' but in fact it was 'PDF-lasku s?hk?postiin'.
I need to write something like that, but I don't know how:
PDF-lasku s[ascii symbol]hk[ascii symbol]postiin
can somebody help me?
I would probably convert the whole thing to one format or another, then evaluate? Or is it important that ASCII characters are located in certain parts of the string? If not and you simply want to verify what is returned is exactly what you expect, I'd probably use Encode String to Bytes for simplicity, perhaps even the encoding/decoding keyword would serve your needs if the ASCII is important.
http://robotframework.org/robotframework/latest/libraries/String.html#Encode%20String%20To%20Bytes
By using the above you could set it to ignore the characters that cannot be converted or replace them with a known character that you provide. Simply get the text first, then perform whatever manipulation you want and evaluate.
The alternative with regard to decoding/encoding if ASCII location is important is:
http://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Convert%20To%20Bytes