Re: WHAT THE ERROR ON MY CODE???

2022-06-28 Thread נתי שטרן
Sorry but i forgor to delete this token data

בתאריך יום שלישי, 28 ביוני 2022, מאת De ongekruisigde <
ongekruisi...@news.eternal-september.org>:

> On 2022-06-28, Chris Angelico  wrote:
> > ‪On Wed, 29 Jun 2022 at 01:37, ‫נתי שטרן‬‎  wrote:‬
> >> headers["Authorization"] = "Basic
> >> YjMwMzcwODY3NTUzNDMwNTg5NzA2MjkyNDFmMDE1YWY6VjNKYTk2Y1F4RTFz
> eTdYbzRnbkt0a2k1djhscXUyU01oSE5VWUwwRg=="
> >>
> >
> > The error is that you just revealed your credentials to the whole
> > world. This is a public mailing list.
> >
> > In fact, you just revealed your credentials to TWO mailing lists at once.
>
> I think the term 'script kiddie' applies here.
>
>
> > Good job.
> >
> > ChrisA
>
>
> --
> Without followers, evil cannot spread.
>
> [Spock, "And The Children Shall Lead", stardate 5029.5]
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: REPL with multiple function definitions

2022-06-28 Thread Chris Angelico
On Wed, 29 Jun 2022 at 11:00, Rob Cliffe via Python-list
 wrote:
>
> On 26/06/2022 23:22, Jon Ribbens via Python-list wrote:
> > On 2022-06-26, Rob Cliffe  wrote:
> >> This 2-line program
> >>
> >> def f(): pass
> >> def g(): pass
> >>
> >> runs silently (no Exception).  But:
> >>
> >> 23:07:02 c:\>python
> >> Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
> >> bit (Intel)] on win32
> >> Type "help", "copyright", "credits" or "license" for more information.
> > def f(): pass
> >> ... def g(): pass
> >> File "", line 2
> >>   def g(): pass
> >>   ^
> >> SyntaxError: invalid syntax
> >> Is there a good reason for this?
> > For some reason, the REPL can't cope with one-line blocks like that.
> > If you put a blank line after each one-block line then it will work.
> It's actually not to do with 1-line blocks, just attempting to define 2
> functions "at once":
>
>
> 22:27:23 C:\>python
> Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> def f():
> ... return 42
> ... def g():
>File "", line 3
>  def g():
>  ^
> SyntaxError: invalid syntax
>  >>>
>
> But you are right that adding a blank line after the first function
> definition solves the "problem".

And if you have something where you want to copy and paste multiple
statements, there are a few ways to do it:

1) Put "if 1:" at the top. That makes it a single block, so you can
paste in as much as you like, as long as the only blank line is at the
end.

2) Put the code into a file and then use "python3 -i setup.py". That
runs all the code, then drops you into the REPL in that context.

3) Put the code into a file, and inside the REPL, "from setup import
*". Unlike option 2, this can be done after the beginning of the
session. Downside: editing setup.py and reimporting won't apply your
changes.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: REPL with multiple function definitions

2022-06-28 Thread Rob Cliffe via Python-list

On 26/06/2022 23:22, Jon Ribbens via Python-list wrote:

On 2022-06-26, Rob Cliffe  wrote:

This 2-line program

def f(): pass
def g(): pass

runs silently (no Exception).  But:

23:07:02 c:\>python
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

def f(): pass

... def g(): pass
    File "", line 2
      def g(): pass
      ^
SyntaxError: invalid syntax
Is there a good reason for this?

For some reason, the REPL can't cope with one-line blocks like that.
If you put a blank line after each one-block line then it will work.
It's actually not to do with 1-line blocks, just attempting to define 2 
functions "at once":



22:27:23 C:\>python
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 
bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> def f():
... return 42
... def g():
  File "", line 3
    def g():
    ^
SyntaxError: invalid syntax
>>>

But you are right that adding a blank line after the first function 
definition solves the "problem".

Rob Cliffe


--
https://mail.python.org/mailman/listinfo/python-list


Re: WHAT THE ERROR ON MY CODE???

2022-06-28 Thread De ongekruisigde
On 2022-06-28, Chris Angelico  wrote:
> ‪On Wed, 29 Jun 2022 at 01:37, ‫נתי שטרן‬‎  wrote:‬
>> headers["Authorization"] = "Basic
>> YjMwMzcwODY3NTUzNDMwNTg5NzA2MjkyNDFmMDE1YWY6VjNKYTk2Y1F4RTFzeTdYbzRnbkt0a2k1djhscXUyU01oSE5VWUwwRg=="
>>
>
> The error is that you just revealed your credentials to the whole
> world. This is a public mailing list.
>
> In fact, you just revealed your credentials to TWO mailing lists at once.

I think the term 'script kiddie' applies here.


> Good job.
>
> ChrisA


-- 
Without followers, evil cannot spread.  
 
[Spock, "And The Children Shall Lead", stardate 5029.5]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: WHAT THE ERROR ON MY CODE???

2022-06-28 Thread David Lowry-Duda
Please don't use all caps in the subject line. It comes across as if 
you're yelling at the list --- this doesn't make people want to be more 
helpful.


Instead, use meaningful, specific subject headers. Also, please be 
precise and informative about what your problem is. It's not clear what 
you expect your code to do or what happens differently than you expect.


On Tue, Jun 28, 2022 at 04:35:22PM +0300, נתי שטרן wrote:

import requests
from requests.structures import CaseInsensitiveDict

url = "https://api.crowdstrike.com/oauth2/token;


Further, testing your code makes random api calls to some website, which 
I'm disinclined to do without proper context.


For more advice, I suggest reading "How to Ask Questions" at

http://www.catb.org/~esr/faqs/smart-questions.html

- DLD
--
https://mail.python.org/mailman/listinfo/python-list


Re: WHAT THE ERROR ON MY CODE???

2022-06-28 Thread Chris Angelico
‪On Wed, 29 Jun 2022 at 01:37, ‫נתי שטרן‬‎  wrote:‬
> headers["Authorization"] = "Basic
> YjMwMzcwODY3NTUzNDMwNTg5NzA2MjkyNDFmMDE1YWY6VjNKYTk2Y1F4RTFzeTdYbzRnbkt0a2k1djhscXUyU01oSE5VWUwwRg=="
>

The error is that you just revealed your credentials to the whole
world. This is a public mailing list.

In fact, you just revealed your credentials to TWO mailing lists at once.

Good job.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


WHAT THE ERROR ON MY CODE???

2022-06-28 Thread נתי שטרן
import requests
from requests.structures import CaseInsensitiveDict

url = "https://api.crowdstrike.com/oauth2/token;

headers = CaseInsensitiveDict()
headers["Content-Type"] = "application/x-www-form-urlencoded"
headers["Authorization"] = "Basic
YjMwMzcwODY3NTUzNDMwNTg5NzA2MjkyNDFmMDE1YWY6VjNKYTk2Y1F4RTFzeTdYbzRnbkt0a2k1djhscXUyU01oSE5VWUwwRg=="

data = "POST"


resp = requests.post(url, headers=headers, data=data)

print(resp.text)
print(resp.status_code)


import requests
from requests.structures import CaseInsensitiveDict

MYurl = "
https://api.crowdstrike.com/intel/combined/indicators/v1?q=123.123.123.123;

headersa = CaseInsensitiveDict()
headersa["Authorization"] = "Bearer "+resp.text

resp1 = requests.get(MYurl, headers=headersa)

print(resp1.status_code)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: why function throws an error?

2022-06-28 Thread Dennis Lee Bieber
On Tue, 28 Jun 2022 10:57:59 +0300, ???   declaimed
the following:

>def add_route(self, route):
>#""" Add a route object, but do not change the :data:`Route.app`
>#attribute."""
>self.routes.append(route)
>self.router.add(route.rule, route.method, route, name=route.name
>)
>#if DEBUG: route.prepare()

From your subject "why function throws an error?".

How would we know? You never show us the error traceback, you never
provide a minimal code listing that someone could attempt to run to perform
debugging.



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: why function throws an error?

2022-06-28 Thread Lars Liedtke

Hey,

Which error does it throw?
Could you please send the stacktrace as well?

Cheers

Lars


--
Lars Liedtke
Software Entwickler


Phone:  
Fax:+49 721 98993-
E-mail: l...@solute.de


solute GmbH
Zeppelinstraße 15   
76185 Karlsruhe
Germany


Marken der solute GmbH | brands of solute GmbH
billiger.de | Shopping.de 



Geschäftsführer | Managing Director: Dr. Thilo Gans, Bernd Vermaaten
Webseite | www.solute.de
Sitz | Registered Office: Karlsruhe
Registergericht | Register Court: Amtsgericht Mannheim
Registernummer | Register No.: HRB 110579
USt-ID | VAT ID: DE234663798


Informationen zum Datenschutz | Information about privacy policy
http://solute.de/ger/datenschutz/grundsaetze-der-datenverarbeitung.php

Am 28.06.22 um 09:57 schrieb נתי שטרן:

 def add_route(self, route):
 #""" Add a route object, but do not change the :data:`Route.app`
 #attribute."""
 self.routes.append(route)
 self.router.add(route.rule, route.method, route, name=route.name
)
 #if DEBUG: route.prepare()
--



--
https://mail.python.org/mailman/listinfo/python-list


[Python-announce] PyConZA 2022 - Call for Submissions

2022-06-28 Thread Neil Muller
PyConZA 2022 will take place on the 13th & 14th of October, 2022. This
year, PyConZA will be a hybrid conference (with in-person and online
access) hosted at the Premier Splendid Inn in Umhlanga, Durban.

We are looking for the following presentations:
  - Keynotes (45 minute long talks on a subject of general interest)
  - Talks (30 minute long talks on more specific topics)

We are accepting submissions for tutorials, which will run on the 12th
of October. Tutorials can either be half-day (4 hours) or full-day (8
hours).

Currently, we are only accepting talks to be delivered in person at the venue.

If you would like to give a presentation, please register at
https://za.pycon.org/ and submit your proposal, following the
instructions at https://za.pycon.org/talks/submit-talk/ . We have a
number of tracks available, including: Data Science, Teaching and
Learning with Python, Web, Scientific Computing, Testing and Other
(which includes all talks that don't fall under the mentioned tracks).
We hope to notify accepted presenters by no later than the 31st of
August 2022.

Speakers will be expected to be available after the presentation for a
short Q session. Shared sessions are also possible. The
presentations will be in English.

PyConZA offers a mentorship program for inexperienced speakers. If you
would like assistance preparing your submission, email
t...@za.pycon.org with a rough draft of your talk proposal and we'll
find a suitable experienced speaker to act as a mentor.

If you want to present something that doesn't fit into the standard
talk categories at PyConZA, please contact the organising committee at
t...@za.pycon.org so we can discuss whether that will be feasible.

-- 
Neil Muller
On behalf of the PyConZA organising committee
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


Re: why function throws an error?

2022-06-28 Thread Mirko via Python-list

Am 28.06.22 um 09:57 schrieb נתי שטרן:

 def add_route(self, route):
 #""" Add a route object, but do not change the :data:`Route.app`
 #attribute."""
 self.routes.append(route)
 self.router.add(route.rule, route.method, route, name=route.name
)
 #if DEBUG: route.prepare()
--



Are you still trying to combine different modules into one large 
module? That is not going to help you. First, you need to rewrite 
all those modules to seamlessly work together. This will likely be a 
huge task. Let's say you have a module that defines some function 
route():


def route():
print("route")

Another module defines a variable called "route":

route = True

A third module needs to call the function from the first module, but 
this fails now because the second module has overwritten (shadowed) 
the former function with a variable:


route = True
route()

Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'bool' object is not callable


You would need to find all those cases where one module overwrites 
variables or functions from other modules. And sometimes those cases 
will be difficult to spot. Python is not designed for what you are 
trying to do. Even if you get this done, it will not help you. You 
can't just throw everything into a single file and then magically 
optimize it. When you have this huge final module, what do you think 
you can do with it to be faster?


If you have performance problems with some module, you have several 
options to optimize it:


- Find a better algorithm.
- Rewrite performance-critical parts in Cython or even C and import 
the compiled module.

- Use a JIT compiler such as PyPy
--
https://mail.python.org/mailman/listinfo/python-list


why function throws an error?

2022-06-28 Thread נתי שטרן
def add_route(self, route):
#""" Add a route object, but do not change the :data:`Route.app`
#attribute."""
self.routes.append(route)
self.router.add(route.rule, route.method, route, name=route.name
)
#if DEBUG: route.prepare()
--

-- 
https://mail.python.org/mailman/listinfo/python-list