Re: Help - Python REST API

2018-12-13 Thread dieter
Afriyie Abraham Kwabena  writes:
> Am trying to create a basic authorization server using client credentials 
> flow and client so that the
> client can send it credentials using REST methods (POST) to the authorization 
> server. Authrization server then 
> respond with access token. After the access, client can POST, GET, etc to the 
> server for resources.
>
> Can anyone help me or give guidelines how I can achieve this using python?
> Am new in python (average) and need some guidelines or some links.

As Ben already has pointed out, you have various options for the
choice of the web application framework. I add "Zope[2]" to these options,
potentially together with "Products.PluggableAuthService" and
"dm.zope.rpc".

"Zope" is a so called web application framework which comes with everything
typically required for web applications: url traversal, authentication,
publishing, persistent storage in an object oriented database (the "ZODB",
"Zope Object DataBase"), transaction system, permissions and roles,
user management, ...
The real application comes into existence either by putting objects
into the ZODB or by registering "view"s with the framework.

The framework can be easily extended.
"Products.PluggableAuthService" is such an extension to get
an extremely flexible subframework for special authentication
and authorization needs.
"dm.zope.rpc" is another extension which facilitates the
implementation of "rpc" (= "Remote Procedure Call") services with
Zope based on different protocols.



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


Re: python CAD libraries?

2018-12-13 Thread ammon . hepworth
I know this is an old post, but I wanted to recommend another Python CAD library
called Pascale: https://aerion-tech.com/pascale

It creates commercial grade CAD geometry through an intuitive Python API. 
Although it is a paid software, but there is a free version available to use on 
the Cloud.
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: DIPY 0.15.0 release

2018-12-13 Thread Eleftherios Garyfallidis
We are excited to announce a new release of Diffusion Imaging in Python
(DIPY).

DIPY 0.15 (Wednesday, 12 December 2018)

This release received contributions from 30 developers (the full release
notes are at: http://dipy.org/release0.15.html
)

Highlights of this release include:


   -

   Updated RecoBundles for automatic anatomical bundle segmentation.
   -

   New Reconstruction Model: qtau-dMRI signal representation.
   -

   New command line interfaces (e.g., dipy_slr).
   -

   New continuous integration with AppVeyor CI.
   -

   Nibabel Streamlines API now used almost everywhere for better memory
   management.
   -

   Compatibility with Python 3.7.
   -

   Many tutorials added or updated (5 New).
   -

   Large overall documentation update.
   -

   Moved visualization module to a new library: FURY.
   -

   Closed 287 issues and merged 93 pull requests.


Want to learn more?

The DIPY project is hosting an educational workshop March 11-15 at Indiana
University, USA. The event is sponsored by the National Institute of Health
(NIH). See topics and detailed information here:

https://workshop.dipy.org

The workshop will include tutorials on tracking, microstructure, and
statistical analysis. The workshop will also include a data accelerator
where you will be able to analyze your own data together with the DIPY
 developers. More than 15 DIPY developers will be
available this year on site to help. All tutorials will run on 3 levels:
novice, intermediate and advanced. Register here 
.


To upgrade or install  DIPY

Run the following command in your terminal:


pip install --upgrade dipy

or

conda install -c conda-forge dipy

This version of DIPY depends on nibabel (2.3.0+).

Questions or suggestions?

For any questions go to http://dipy.org, or send an e-mail to
d...@python.org 

We also have an instant messaging service and chat room available at
https://gitter.im/nipy/dipy

On behalf of the DIPY developers,

Eleftherios Garyfallidis, Ariel Rokem, Serge Koudoro

http://dipy.org/developers.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python-list Digest, Vol 183, Issue 13

2018-12-13 Thread Afriyie Abraham Kwabena
Hi,

Thanks for the reply maybe I did not explain myself very well but is it 
possible to apply this scenario to a database server like MySQL where I can 
write some python code to post, get, delete, etc to the database? However the 
client (python code I have to write ) have to be authenticated and then after 
that can have access to the data in the server. If this is possible what should 
be my starting point and which python frameworks or libraries do i have to use 
to achieve this. 

Thanks in advance. 

BR
Abraham

Sent from my iPhone

> On 13 Dec 2018, at 19.00, python-list-requ...@python.org wrote:
> 
> Send Python-list mailing list submissions to
>python-list@python.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>https://mail.python.org/mailman/listinfo/python-list
> or, via email, send a message with subject or body 'help' to
>python-list-requ...@python.org
> 
> You can reach the person managing the list at
>python-list-ow...@python.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Python-list digest..."
> Today's Topics:
> 
>   1. setup.py and licensing questions (songbird)
>   2. Help - Python REST API  (Afriyie Abraham Kwabena)
>   3. Re: zeroed out (Dennis Lee Bieber)
>   4. Re: zeroed out (MRAB)
>   5. Re: setup.py and licensing questions (Ben Finney)
>   6. Re: Help - Python REST API (Ben Finney)
>   7. Re: setup.py and licensing questions (songbird)
>   8. When to Use Django & Flask frame work (VENKEY ROKZS)
>   9. Re: When to Use Django & Flask frame work (Ben Finney)
>  10. Re: zeroed out (Gregory Ewing)
>  11. Re: Help - Python REST API (dieter)
>  12. Re: python CAD libraries? (ammon.hepwo...@gmail.com)
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: 03 digression by brute force

2018-12-13 Thread jfong
Just for fun:-) On my ooold PC, it takes 0.047 seconds to run the following 
algorithm on the problem 'SNED + MORE == MONEY".

-
import time
import itertools

#S, E, N, D, M, O, R, Y
n = 0
digits = {x for x in range(10)}

def tenThousand(u, Cin):  # Cin == M
global n
if Cin == M:
print(S, E, N, D, '+', M, O, R, E, '==', M, O, N, E, Y)
n += 1

def thousand(u, Cin):  # Cin + S + M == 10 * Cout + O
global S, M, n
rest = digits - set(u)
for g in itertools.permutations(rest, 2):
for Cout in range(2):
if Cin + g[0] + g[1] == 10 * Cout + O:
S = g[0];  M = g[1]
tenThousand(u + g, Cout)

def hundred(u, Cin):  # Cin + E + O == 10 * Cout + N
global O, n
rest = digits - set(u)
for g in itertools.permutations(rest, 1):
for Cout in range(2):
if Cin + E + g[0] == 10 * Cout + N:
O = g[0]
thousand(u + g, Cout)

def ten(u, Cin):  # Cin + N + R == 10 * Cout + E
global N, R, n
rest = digits - set(u)
for g in itertools.permutations(rest, 2):
for Cout in range(2):
if Cin + g[0] + g[1] == 10 * Cout + E:
N = g[0];  R = g[1]
hundred(u + g, Cout)

def unit():  # D + E == 10 * Cout + Y
global D, E, Y, n
n = 0
for g in itertools.permutations(range(10), 3):  # g is a tuple
for Cout in range(2):  # add two items so Cout is 0 or 1
if g[0] + g[1] == 10 * Cout + g[2]:
D = g[0];  E = g[1];  Y = g[2]
ten(g, Cout)
print(n)

if __name__ == '__main__':
start = time.time()
unit()
print(time.time() - start)
-

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


Re: Help - Python REST API (war: Python-list Digest, Vol 183, Issue 13)

2018-12-13 Thread dieter
Afriyie Abraham Kwabena  writes:
> ...
> Thanks for the reply maybe I did not explain myself very well but is it 
> possible to apply this scenario to a database server like MySQL where I can 
> write some python code to post, get, delete, etc to the database? However the 
> client (python code I have to write ) have to be authenticated and then after 
> that can have access to the data in the server. If this is possible what 
> should be my starting point and which python frameworks or libraries do i 
> have to use to achieve this. 

I have put "Zope" into the ring (for the server side). If your actual
data lives in a relational database, then "Zope" might not be ideal:
while "dm.zope.reseller" demonstrates that "Zope" can be used as an interface
to entities in a relational database, this is not directly supported
and you need some deeper knowledge to get it done.

The particularity of REST is its very limited support for verbs: it knows
only the standard HTTP commands ("GET", "HEAD", "POST", "PUT", "DELETE")
as verbs. You must introduce artificial objects to support a richer
verb set. E.g. to express the verbs "search_users", "add_user",
you would introduce an object "users" and map "search_users --> users/GET",
"add_user --> users/POST"; for "update_user", you would have user objects
representing an individual user and map "update_user --> /PUT".
If you look at this in the relational world, then the object "users"
corresponds to a table, while a user object corresponds to an entry
in this table, i.e. those objects live on different representational
levels (table, table entry) in the relational database.

Out of the box, Zope only has limited support for this kind
of modelization: its "ZSQL Method"s can be used to represent a table;
their "direct traversal" can be used to represent a table entry.
But, you must do special things to get the REST expected semantics
of "POST", "PUT" and "DELETE".


The client side should be easy -- at least, if the number of objects
you must support is small. You can then use the module "urllib2/http.client"
likely together with the module "json".



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